Use this skill when writing or improving concept documentation pages for the 33 JavaScript Concepts project.
当你为33 JavaScript Concepts项目编写或优化概念文档页面时,使用本技能。
When to Use
使用场景
Creating a new concept page in
/docs/concepts/
Rewriting or significantly improving an existing concept page
Reviewing an existing concept page for quality and completeness
Adding explanatory content to a concept
在
/docs/concepts/
目录下创建新的概念页面
重写或大幅优化现有概念页面
审核现有概念页面的质量与完整性
为概念页面添加解释性内容
Target Audience
目标受众
Remember: the reader might be someone who has never coded before or is just learning JavaScript. Write with empathy for beginners while still providing depth for intermediate developers. Make complex topics feel approachable and never assume prior knowledge without linking to prerequisites.
Conversational but authoritative: Write like you're explaining to a smart friend
Encouraging: Make complex topics feel approachable
Practical: Focus on real-world applications and use cases
Concise: Respect the reader's time; avoid unnecessary verbosity
Question-driven: Open sections with questions the reader might have
口语化但专业:就像给聪明的朋友讲解一样写作
鼓励性:让复杂主题显得易于上手
实用性:聚焦实际应用场景
简洁性:尊重读者时间,避免冗余内容
问题驱动:用读者可能会问的问题开启章节
Avoiding AI-Generated Language
避免AI生成式语言
Your writing must sound human, not AI-generated. Here are specific patterns to avoid:
你的写作必须听起来像人类创作,而非AI生成。以下是需要避免的特定模式:
Words and Phrases to Avoid
需避免的词汇与短语
❌ Avoid
✓ Use Instead
"Master [concept]"
"Learn [concept]"
"dramatically easier/better"
"much easier" or "cleaner"
"one fundamental thing"
"one simple thing"
"one of the most important concepts"
"This is a big one"
"essential points"
"key things to remember"
"understanding X deeply improves"
"knowing X well makes Y easier"
"To truly understand"
"Let's look at" or "Here's how"
"This is crucial"
"This trips people up"
"It's worth noting that"
Just state the thing directly
"It's important to remember"
"Don't forget:" or "Remember:"
"In order to"
"To"
"Due to the fact that"
"Because"
"At the end of the day"
Remove entirely
"When it comes to"
Remove or rephrase
"In this section, we will"
Just start explaining
"As mentioned earlier"
Remove or link to the section
❌ 需避免
✓ 替代表达
"Master [concept]"
"Learn [concept]"
"dramatically easier/better"
"much easier" 或 "cleaner"
"one fundamental thing"
"one simple thing"
"one of the most important concepts"
"This is a big one"
"essential points"
"key things to remember"
"understanding X deeply improves"
"knowing X well makes Y easier"
"To truly understand"
"Let's look at" 或 "Here's how"
"This is crucial"
"This trips people up"
"It's worth noting that"
直接陈述内容即可
"It's important to remember"
"Don't forget:" 或 "Remember:"
"In order to"
"To"
"Due to the fact that"
"Because"
"At the end of the day"
直接删除
"When it comes to"
删除或改写
"In this section, we will"
直接开始讲解
"As mentioned earlier"
删除或链接到对应章节
Repetitive Emphasis Patterns
重复强调模式
Don't use the same lead-in pattern repeatedly. Vary your emphasis:
Instead of repeating...
Vary with...
"Key insight:"
"Don't forget:", "The pattern:", "Here's the thing:"
"Best practice:"
"Pro tip:", "Quick check:", "A good habit:"
"Important:"
"Watch out:", "Heads up:", "Note:"
"Remember:"
"Keep in mind:", "The rule:", "Think of it this way:"
不要重复使用相同的引导模式。多样化你的强调方式:
避免重复...
替换为...
"Key insight:"
"Don't forget:", "The pattern:", "Here's the thing:"
"Best practice:"
"Pro tip:", "Quick check:", "A good habit:"
"Important:"
"Watch out:", "Heads up:", "Note:"
"Remember:"
"Keep in mind:", "The rule:", "Think of it this way:"
Em Dash (—) Overuse
过度使用破折号(—)
AI-generated text overuses em dashes. Limit their use and prefer periods, commas, or colons:
❌ Em Dash Overuse
✓ Better Alternative
"async/await — syntactic sugar that..."
"async/await. It's syntactic sugar that..."
"understand Promises — async/await is built..."
"understand Promises. async/await is built..."
"doesn't throw an error — you just get..."
"doesn't throw an error. You just get..."
"outside of async functions — but only in..."
"outside of async functions, but only in..."
"Fails fast — if any Promise rejects..."
"Fails fast. If any Promise rejects..."
"achieve the same thing — the choice..."
"achieve the same thing. The choice..."
When em dashes ARE acceptable:
In Key Takeaways section (consistent formatting for the numbered list)
In MDN card titles (e.g., "async function — MDN")
In interview answer step-by-step explanations (structured formatting)
Sparingly when a true parenthetical aside reads naturally
Rule of thumb: If you have more than 10-15 em dashes in a 1500-word document outside of structured sections, you're overusing them. After writing, search for "—" and evaluate each one.
remove (if you need it, you're not explaining clearly)
"essentially"
remove or just explain directly
"very"
remove or use a stronger word
"really"
remove
"actually"
remove (unless correcting a misconception)
"In fact"
remove (just state the fact)
"Interestingly"
remove (let the reader decide if it's interesting)
避免使用无实际信息的模糊最高级:
❌ 需避免
✓ 替代表达
"dramatically"
"much" 或直接删除
"fundamentally"
"simply" 或具体说明哪些是基础内容
"incredibly"
删除或具体说明
"extremely"
删除或具体说明
"absolutely"
删除
"basically"
删除(如果需要这个词,说明你的解释不够清晰)
"essentially"
删除或直接解释
"very"
删除或使用更有力的词汇
"really"
删除
"actually"
删除(除非用于纠正误解)
"In fact"
删除(直接陈述事实即可)
"Interestingly"
删除(让读者自行判断是否有趣)
Stiff/Formal Phrases
生硬/正式短语
Replace formal academic-style phrases with conversational alternatives:
❌ Stiff
✓ Conversational
"It should be noted that"
"Note that" or just state it
"One might wonder"
"You might wonder"
"This enables developers to"
"This lets you"
"The aforementioned"
"this" or name it again
"Subsequently"
"Then" or "Next"
"Utilize"
"Use"
"Commence"
"Start"
"Prior to"
"Before"
"In the event that"
"If"
"A considerable amount of"
"A lot of" or "Many"
用口语化表达替代正式的学术风格短语:
❌ 生硬表达
✓ 口语化表达
"It should be noted that"
"Note that" 或直接陈述内容
"One might wonder"
"You might wonder"
"This enables developers to"
"This lets you"
"The aforementioned"
"this" 或再次提及名称
"Subsequently"
"Then" 或 "Next"
"Utilize"
"Use"
"Commence"
"Start"
"Prior to"
"Before"
"In the event that"
"If"
"A considerable amount of"
"A lot of" 或 "Many"
Playful Touches (Use Sparingly)
趣味点缀(适度使用)
Add occasional human touches to make the content feel less robotic, but don't overdo it:
javascript
// ✓ Good: One playful comment per section// Callback hell - nested so deep you need a flashlight// ✓ Good: Conversational aside // forEach and async don't play well together — it just fires and forgets:// ✓ Good: Relatable frustration// Finally, error handling that doesn't make you want to flip a table.// ❌ Bad: Trying too hard// Callback hell - it's like a Russian nesting doll had a baby with a spaghetti monster! 🍝// ❌ Bad: Forced humor// Let's dive into the AMAZING world of Promises! 🎉🚀
Guidelines:
One or two playful touches per major section is enough
Humor should arise naturally from the content
Avoid emojis in body text (they're fine in comments occasionally)
Don't explain your jokes
If a playful line doesn't work, just be direct instead
Every concept page MUST follow this structure in this exact order:
mdx
---
title: "Concept Name: [Hook] in JavaScript"
sidebarTitle: "Concept Name: [Hook]"
description: "SEO-friendly description in 150-160 characters starting with action word"
---
[Opening hook - Start with engaging questions that make the reader curious]
[Example: "How does JavaScript get data from a server? How do you load user profiles, submit forms, or fetch the latest posts from an API?"]
[Immediately show a simple code example demonstrating the concept]
```javascript
// This is how you [do the thing] in JavaScript
const example = doSomething()
console.log(example) // Expected output
[Brief explanation connecting to what they'll learn, with inline MDN links for key terms]
<Info>
**What you'll learn in this guide:**
- Key learning outcome 1
- Key learning outcome 2
- Key learning outcome 3
- Key learning outcome 4 (aim for 5-7 items)
</Info>
<Warning>
[Optional: Prerequisites or important notices - place AFTER Info box]
**Prerequisite:** This guide assumes you understand [Related Concept](/concepts/related-concept). If you're not comfortable with that yet, read that guide first!
</Warning>
[Deep dive with code examples, tables, and Mintlify components]
<Steps>
<Step title="Step 1">
Explanation of the first step
</Step>
<Step title="Step 2">
Explanation of the second step
</Step>
</Steps>
<AccordionGroup>
<Accordion title="Subtopic 1">
Detailed explanation with code examples
</Accordion>
<Accordion title="Subtopic 2">
Detailed explanation with code examples
</Accordion>
</AccordionGroup>
<Tip>
**Quick Rule of Thumb:** [Memorable summary or mnemonic]
</Tip>
<CardGroup cols={2}>
<Card title="Related Concept 1" icon="icon-name" href="/concepts/slug">
How it connects to this concept
</Card>
<Card title="Related Concept 2" icon="icon-name" href="/concepts/slug">
How it connects to this concept
</Card>
</CardGroup>
<CardGroup cols={2}>
<Card title="Article Title" icon="newspaper" href="https://...">
Brief description of what the reader will learn from this article.
</Card>
[Aim for 4-6 high-quality articles]
</CardGroup>
<CardGroup cols={2}>
<Card title="Video Title" icon="video" href="https://...">
Brief description of what the video covers.
</Card>
[Aim for 3-4 quality videos]
</CardGroup>
```
SEO (Search Engine Optimization) is critical for this project. Each concept page should rank for the various ways developers search for that concept. Our goal is to appear in search results for queries like:
"what is [concept] in JavaScript"
"how does [concept] work in JavaScript"
"[concept] JavaScript explained"
"[concept] JavaScript tutorial"
"JavaScript [concept] example"
Every writing decision — from title to structure to word choice — should consider search intent.
Each concept page targets a keyword cluster — the family of related search queries. Before writing, identify these for your concept:
Keyword Type
Pattern
Example (DOM)
Primary
[concept] + JavaScript
"DOM JavaScript", "JavaScript DOM"
What is
what is [concept] in JavaScript
"what is the DOM in JavaScript"
How does
how does [concept] work
"how does the DOM work in JavaScript"
How to
how to [action] with [concept]
"how to manipulate the DOM"
Tutorial
[concept] tutorial/guide/explained
"DOM tutorial JavaScript"
Comparison
[concept] vs [related]
"DOM vs virtual DOM"
More Keyword Cluster Examples:
<AccordionGroup>
<Accordion title="Closures Keyword Cluster">
| Type | Keywords |
|------|----------|
| Primary | "JavaScript closures", "closures in JavaScript" |
| What is | "what is a closure in JavaScript", "what are closures" |
| How does | "how do closures work in JavaScript", "how closures work" |
| Why use | "why use closures JavaScript", "closure use cases" |
| Example | "JavaScript closure example", "closure examples" |
| Interview | "closure interview questions JavaScript" |
</Accordion>
<Accordion title="Promises Keyword Cluster">
| Type | Keywords |
|------|----------|
| Primary | "JavaScript Promises", "Promises in JavaScript" |
| What is | "what is a Promise in JavaScript", "what are Promises" |
| How does | "how do Promises work", "how Promises work JavaScript" |
| How to | "how to use Promises", "how to chain Promises" |
| Comparison | "Promises vs callbacks", "Promises vs async await" |
| Error | "Promise error handling", "Promise catch" |
</Accordion>
<Accordion title="Event Loop Keyword Cluster">
| Type | Keywords |
|------|----------|
| Primary | "JavaScript event loop", "event loop JavaScript" |
| What is | "what is the event loop in JavaScript" |
| How does | "how does the event loop work", "how event loop works" |
| Visual | "event loop explained", "event loop visualization" |
| Related | "call stack and event loop", "task queue JavaScript" |
</Accordion>
<Accordion title="Call Stack Keyword Cluster">
| Type | Keywords |
|------|----------|
| Primary | "JavaScript call stack", "call stack JavaScript" |
| What is | "what is the call stack in JavaScript" |
| How does | "how does the call stack work" |
| Error | "call stack overflow JavaScript", "maximum call stack size exceeded" |
| Visual | "call stack explained", "call stack visualization" |
</Accordion>
</AccordionGroup>
每个概念页面都针对一个关键词集群——相关搜索查询的集合。写作前,先确定你的概念对应的关键词集群:
关键词类型
模式
示例(DOM)
主关键词
[概念] + JavaScript
"DOM JavaScript", "JavaScript DOM"
定义类
what is [concept] in JavaScript
"what is the DOM in JavaScript"
原理类
how does [concept] work
"how does the DOM work in JavaScript"
操作类
how to [action] with [concept]
"how to manipulate the DOM"
教程类
[concept] tutorial/guide/explained
"DOM tutorial JavaScript"
对比类
[concept] vs [related]
"DOM vs virtual DOM"
更多关键词集群示例:
<AccordionGroup>
<Accordion title="闭包关键词集群">
| 类型 | 关键词 |
|------|----------|
| 主关键词 | "JavaScript closures", "closures in JavaScript" |
| 定义类 | "what is a closure in JavaScript", "what are closures" |
| 原理类 | "how do closures work in JavaScript", "how closures work" |
| 应用类 | "why use closures JavaScript", "closure use cases" |
| 示例类 | "JavaScript closure example", "closure examples" |
| 面试类 | "closure interview questions JavaScript" |
</Accordion>
<Accordion title="Promises关键词集群">
| 类型 | 关键词 |
|------|----------|
| 主关键词 | "JavaScript Promises", "Promises in JavaScript" |
| 定义类 | "what is a Promise in JavaScript", "what are Promises" |
| 原理类 | "how do Promises work", "how Promises work JavaScript" |
| 操作类 | "how to use Promises", "how to chain Promises" |
| 对比类 | "Promises vs callbacks", "Promises vs async await" |
| 错误类 | "Promise error handling", "Promise catch" |
</Accordion>
<Accordion title="事件循环关键词集群">
| 类型 | 关键词 |
|------|----------|
| 主关键词 | "JavaScript event loop", "event loop JavaScript" |
| 定义类 | "what is the event loop in JavaScript" |
| 原理类 | "how does the event loop work", "how event loop works" |
| 可视化类 | "event loop explained", "event loop visualization" |
| 关联类 | "call stack and event loop", "task queue JavaScript" |
</Accordion>
<Accordion title="调用栈关键词集群">
| 类型 | 关键词 |
|------|----------|
| 主关键词 | "JavaScript call stack", "call stack JavaScript" |
| 定义类 | "what is the call stack in JavaScript" |
| 原理类 | "how does the call stack work" |
| 错误类 | "call stack overflow JavaScript", "maximum call stack size exceeded" |
| 可视化类 | "call stack explained", "call stack visualization" |
</Accordion>
</AccordionGroup>
Title Tag Optimization
标题标签优化
The frontmatter has two title fields:
title
— The page's
<title>
tag (SEO, appears in search results)
sidebarTitle
— The sidebar navigation text (cleaner, no "JavaScript" since we're on a JS site)
The Two-Title Pattern:
mdx
---
title: "Closures: How Functions Remember Their Scope in JavaScript"
sidebarTitle: "Closures: How Functions Remember Their Scope"
---
title
ends with "in JavaScript" for SEO keyword placement
sidebarTitle
omits "JavaScript" for cleaner navigation
Rules:
50-60 characters ideal length for
title
(Google truncates longer titles)
Concept name first — lead with the topic, "JavaScript" comes at the end
Add a hook — what will the reader understand or be able to do?
Be specific — generic titles don't rank
Title Formulas That Work:
title: "[Concept]: [What You'll Understand] in JavaScript"
sidebarTitle: "[Concept]: [What You'll Understand]"
title: "[Concept]: [Benefit or Outcome] in JavaScript"
sidebarTitle: "[Concept]: [Benefit or Outcome]"
Title Examples:
❌ Bad
✓ title (SEO)
✓ sidebarTitle (Navigation)
"Closures"
"Closures: How Functions Remember Their Scope in JavaScript"
"Closures: How Functions Remember Their Scope"
"DOM"
"DOM: How Browsers Represent Web Pages in JavaScript"
"DOM: How Browsers Represent Web Pages"
"Promises"
"Promises: Handling Async Operations in JavaScript"
"Promises: Handling Async Operations"
"Call Stack"
"Call Stack: How Function Execution Works in JavaScript"
"Call Stack: How Function Execution Works"
"Event Loop"
"Event Loop: How Async Code Actually Runs in JavaScript"
"Event Loop: How Async Code Actually Runs"
"Scope"
"Scope and Closures: Variable Visibility in JavaScript"
"Scope and Closures: Variable Visibility"
"this"
"this: How Context Binding Works in JavaScript"
"this: How Context Binding Works"
"Prototype"
"Prototype Chain: Understanding Inheritance in JavaScript"
"Prototype Chain: Understanding Inheritance"
Character Count Check:
Before finalizing, verify your
title
length:
Under 50 chars: Consider adding more descriptive context
50-60 chars: Perfect length
Over 60 chars: Will be truncated in search results — shorten it
前置元数据中有两个标题字段:
title
— 页面的
<title>
标签(用于SEO,出现在搜索结果中)
sidebarTitle
— 侧边栏导航文本(更简洁,因我们是JS站点,无需重复"JavaScript")
双标题模式:
mdx
---
title: "Closures: How Functions Remember Their Scope in JavaScript"
sidebarTitle: "Closures: How Functions Remember Their Scope"
---
title
以"in JavaScript"结尾,用于SEO关键词布局
sidebarTitle
省略"JavaScript",让导航更简洁
规则:
title
理想长度为50-60字符(Google会截断更长的标题)
先写概念名称 — 以主题开头,"JavaScript"放在末尾
添加钩子 — 说明读者将理解什么或能做什么
具体化 — 通用标题无法获得好排名
有效的标题公式:
title: "[概念]: [你将理解的内容] in JavaScript"
sidebarTitle: "[概念]: [你将理解的内容]"
title: "[概念]: [收益或成果] in JavaScript"
sidebarTitle: "[概念]: [收益或成果]"
标题示例:
❌ 糟糕
✓ title(SEO优化)
✓ sidebarTitle(导航优化)
"Closures"
"Closures: How Functions Remember Their Scope in JavaScript"
"Closures: How Functions Remember Their Scope"
"DOM"
"DOM: How Browsers Represent Web Pages in JavaScript"
"DOM: How Browsers Represent Web Pages"
"Promises"
"Promises: Handling Async Operations in JavaScript"
"Promises: Handling Async Operations"
"Call Stack"
"Call Stack: How Function Execution Works in JavaScript"
"Call Stack: How Function Execution Works"
"Event Loop"
"Event Loop: How Async Code Actually Runs in JavaScript"
"Event Loop: How Async Code Actually Runs"
"Scope"
"Scope and Closures: Variable Visibility in JavaScript"
"Scope and Closures: Variable Visibility"
"this"
"this: How Context Binding Works in JavaScript"
"this: How Context Binding Works"
"Prototype"
"Prototype Chain: Understanding Inheritance in JavaScript"
"Prototype Chain: Understanding Inheritance"
字符数检查:
最终确定前,验证你的
title
长度:
少于50字符:考虑添加更多描述性内容
50-60字符:完美长度
超过60字符:会在搜索结果中被截断 — 请缩短
Meta Description Optimization
元描述优化
The
description
field becomes the meta description — the snippet users see in search results. A compelling description increases click-through rate.
Rules:
150-160 characters maximum (Google truncates longer descriptions)
Include primary keyword in the first half
Include secondary keywords naturally if space allows
Start with an action word — "Learn", "Understand", "Discover" (avoid "Master" — sounds AI-generated)
Promise specific value — what will they learn?
End with a hook — give them a reason to click
Description Formula:
[Action word] [what the concept is] in JavaScript. [Specific things they'll learn]: [topic 1], [topic 2], and [topic 3].
Description Examples:
Concept
❌ Too Short (Low CTR)
✓ SEO-Optimized (150-160 chars)
DOM
"Understanding the DOM"
"Learn how the DOM works in JavaScript. Understand how browsers represent HTML as a tree, select and manipulate elements, traverse nodes, and optimize rendering."
Closures
"Functions that remember"
"Learn JavaScript closures and how functions remember their scope. Covers lexical scoping, practical use cases, memory considerations, and common closure patterns."
Promises
"Async JavaScript"
"Understand JavaScript Promises for handling asynchronous operations. Learn to create, chain, and combine Promises, handle errors properly, and write cleaner async code."
Event Loop
"How async works"
"Discover how the JavaScript event loop manages async code execution. Understand the call stack, task queue, microtasks, and why JavaScript is single-threaded but non-blocking."
Call Stack
"Function execution"
"Learn how the JavaScript call stack tracks function execution. Understand stack frames, execution context, stack overflow errors, and how recursion affects the stack."
this
"Understanding this"
"Learn the 'this' keyword in JavaScript and how context binding works. Covers the four binding rules, arrow function behavior, and how to use call, apply, and bind."
Character Count Check:
Under 120 chars: You're leaving value on the table — add more specifics
150-160 chars: Optimal length
Over 160 chars: Will be truncated — edit ruthlessly
"Learn how the DOM works in JavaScript. Understand how browsers represent HTML as a tree, select and manipulate elements, traverse nodes, and optimize rendering."
闭包
"Functions that remember"
"Learn JavaScript closures and how functions remember their scope. Covers lexical scoping, practical use cases, memory considerations, and common closure patterns."
Promises
"Async JavaScript"
"Understand JavaScript Promises for handling asynchronous operations. Learn to create, chain, and combine Promises, handle errors properly, and write cleaner async code."
事件循环
"How async works"
"Discover how the JavaScript event loop manages async code execution. Understand the call stack, task queue, microtasks, and why JavaScript is single-threaded but non-blocking."
调用栈
"Function execution"
"Learn how the JavaScript call stack tracks function execution. Understand stack frames, execution context, stack overflow errors, and how recursion affects the stack."
this
"Understanding this"
"Learn the 'this' keyword in JavaScript and how context binding works. Covers the four binding rules, arrow function behavior, and how to use call, apply, and bind."
字符数检查:
少于120字符:你浪费了展示价值的机会 — 添加更多细节
150-160字符:最佳长度
超过160字符:会被截断 — 无情地编辑缩短
Keyword Placement Strategy
关键词布局策略
Keywords must appear in strategic locations — but always naturally. Keyword stuffing hurts rankings.
Priority Placement Locations:
Priority
Location
How to Include
🔴 Critical
Title
Primary keyword in first half
🔴 Critical
Meta description
Primary keyword + 1-2 secondary
🔴 Critical
First paragraph
Natural mention within first 100 words
🟠 High
H2 headings
Question-format headings with keywords
🟠 High
"What you'll learn" box
Topic-related phrases
🟡 Medium
H3 subheadings
Related keywords and concepts
🟡 Medium
Key Takeaways
Reinforce main keywords naturally
🟢 Good
Alt text
If using images, include keywords
Example: Keyword Placement for DOM Page
mdx
---
title: "DOM: How Browsers Represent Web Pages in JavaScript" ← 🔴 Primary: "in JavaScript" at end
sidebarTitle: "DOM: How Browsers Represent Web Pages" ← Sidebar: no "JavaScript"
description: "Learn how the DOM works in JavaScript. Understand ← 🔴 Primary: "DOM works in JavaScript"
how browsers represent HTML as a tree, select and manipulate ← 🔴 Secondary: "manipulate elements"
elements, traverse nodes, and optimize rendering."
---
How does JavaScript change what you see on a webpage? ← Hook question
The **Document Object Model (DOM)** is a programming interface ← 🔴 Primary keyword in first paragraph
for web documents. It represents your HTML as a **tree of
objects** that JavaScript can read and manipulate.
<Info>
**What you'll learn in this guide:** ← 🟠 Topic reinforcement
- What the DOM actually is
- How to select elements (getElementById vs querySelector) ← Secondary keywords
- How to traverse the DOM tree
- How to create, modify, and remove elements ← "DOM" implicit
- How browsers render the DOM (Critical Rendering Path)
</Info>
关键词必须放在关键位置 — 但务必自然。关键词堆砌会损害排名。
优先级布局位置:
优先级
位置
如何融入
🔴 关键
标题
主关键词放在前半部分
🔴 关键
元描述
主关键词 + 1-2个次要关键词
🔴 关键
第一段
在前100个单词内自然提及
🟠 高
H2标题
用包含关键词的问题式标题
🟠 高
"你将学到什么"框
关联主题的短语
🟡 中
H3子标题
相关关键词和概念
🟡 中
关键要点
自然强化主关键词
🟢 好
替代文本
如果使用图片,在替代文本中包含关键词
示例:DOM页面的关键词布局
mdx
---
title: "DOM: How Browsers Represent Web Pages in JavaScript" ← 🔴 主关键词:末尾的"in JavaScript"
sidebarTitle: "DOM: How Browsers Represent Web Pages" ← 侧边栏:无"JavaScript"
description: "Learn how the DOM works in JavaScript. Understand ← 🔴 主关键词:"DOM works in JavaScript"
how browsers represent HTML as a tree, select and manipulate ← 🔴 次要关键词:"manipulate elements"
elements, traverse nodes, and optimize rendering."
---
How does JavaScript change what you see on a webpage? ← 钩子问题
The **Document Object Model (DOM)** is a programming interface ← 🔴 第一段出现主关键词
for web documents. It represents your HTML as a **tree of
objects** that JavaScript can read and manipulate.
<Info>
**What you'll learn in this guide:** ← 🟠 主题强化
- What the DOM actually is
- How to select elements (getElementById vs querySelector) ← 次要关键词
- How to traverse the DOM tree
- How to create, modify, and remove elements ← 隐含"DOM"
- How browsers render the DOM (Critical Rendering Path)
</Info>
What is the DOM in JavaScript? ← 🟠 H2 with question keyword
What is the DOM in JavaScript? ← 🟠 包含问题式关键词的H2
The DOM (Document Object Model) is... ← Natural repetition
The DOM (Document Object Model) is... ← 自然重复关键词
How the DOM Works ← 🟠 H2 with "how" keyword
How the DOM Works ← 🟠 包含"how"的关键词H2
DOM Manipulation Methods ← 🟡 H3 with related keyword
DOM Manipulation Methods ← 🟡 包含相关关键词的H3
Key Takeaways ← 🟡 Reinforce in summary
Key Takeaways ← 🟡 在总结中强化关键词
**Warning Signs of Keyword Stuffing:**
- Same exact phrase appears more than 3-4 times per 1000 words
- Sentences read awkwardly because keywords were forced in
- Using keywords where pronouns ("it", "they", "this") would be natural
---
Google ranks pages that directly answer the user's query. Structure your content to satisfy search intent immediately.
The First Paragraph Rule:
The first paragraph after any H2 should directly answer the implied question. Don't build up to the answer — lead with it.
mdx
<!-- ❌ BAD: Builds up to the answer -->
Google会优先排名直接回答用户查询的页面。调整你的内容结构,立即满足搜索意图。
H2后第一段规则:
任何H2后的第一段都应直接回答隐含的问题。不要铺垫,直接给出答案。
mdx
<!-- ❌ 糟糕:铺垫后才给出答案 -->
What is the Event Loop?
What is the Event Loop?
Before we can understand the event loop, we need to talk about JavaScript's
single-threaded nature. You see, JavaScript can only do one thing at a time,
and this creates some interesting challenges. The way JavaScript handles
this is through something called... the event loop.
<!-- ✓ GOOD: Answers immediately -->
Before we can understand the event loop, we need to talk about JavaScript's
single-threaded nature. You see, JavaScript can only do one thing at a time,
and this creates some interesting challenges. The way JavaScript handles
this is through something called... the event loop.
<!-- ✓ 优秀:立即给出答案 -->
What is the Event Loop?
What is the Event Loop?
The event loop is JavaScript's mechanism for executing code, handling events,
and managing asynchronous operations. It continuously monitors the call stack
and task queue, moving queued callbacks to the stack when it's empty — this is
how JavaScript handles async code despite being single-threaded.
**Question-Format H2 Headings:**
Use H2s that match how people search:
| Search Query | H2 to Use |
|--------------|-----------|
| "what is the DOM" | `## What is the DOM?` |
| "how closures work" | `## How Do Closures Work?` |
| "why use promises" | `## Why Use Promises?` |
| "when to use async await" | `## When Should You Use async/await?` |
---
The event loop is JavaScript's mechanism for executing code, handling events,
and managing asynchronous operations. It continuously monitors the call stack
and task queue, moving queued callbacks to the stack when it's empty — this is
how JavaScript handles async code despite being single-threaded.
**问题式H2标题:**
使用符合用户搜索方式的H2标题:
| 搜索查询 | 推荐使用的H2 |
|--------------|-----------|
| "what is the DOM" | `## What is the DOM?` |
| "how closures work" | `## How Do Closures Work?` |
| "why use promises" | `## Why Use Promises?` |
| "when to use async await" | `## When Should You Use async/await?` |
---
Featured Snippet Optimization
特色摘要优化
Featured snippets appear at position zero — above all organic results. Structure your content to win them.
Snippet Types and How to Win Them:
┌─────────────────────────────────────────────────────────────────────────┐
│ FEATURED SNIPPET TYPES │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ QUERY TYPE SNIPPET FORMAT YOUR CONTENT STRUCTURE │
│ ─────────── ────────────── ───────────────────────── │
│ │
│ "What is X" Paragraph 40-60 word definition │
│ immediately after H2 │
│ │
│ "How to X" Numbered list <Steps> component or │
│ numbered Markdown list │
│ │
│ "X vs Y" Table Comparison table with │
│ clear column headers │
│ │
│ "Types of X" Bulleted list Bullet list under │
│ descriptive H2 │
│ │
│ "[X] examples" Bulleted list or Code examples with │
│ code block brief explanations │
│ │
└─────────────────────────────────────────────────────────────────────────┘
A closure is a function that retains access to variables from its outer
(enclosing) scope, even after that outer function has finished executing.
Closures are created every time a function is created in JavaScript, allowing
inner functions to "remember" and access their lexical environment.
**Why this wins:**
- H2 matches search query exactly
- Bold keyword in first sentence
- 40-60 word complete definition
- Explains the "why" not just the "what"
**Pattern 2: List Snippet (Steps)**
For "how to [action]" queries:
```mdx
A closure is a function that retains access to variables from its outer
(enclosing) scope, even after that outer function has finished executing.
Closures are created every time a function is created in JavaScript, allowing
inner functions to "remember" and access their lexical environment.
<Steps>
<Step title="1. Call fetch() with the URL">
The `fetch()` function takes a URL and returns a Promise that resolves to a Response object.
</Step>
<Step title="2. Check if the response was successful">
Always verify `response.ok` before processing — fetch doesn't throw on HTTP errors.
</Step>
<Step title="3. Parse the response body">
Use `response.json()` for JSON data, `response.text()` for plain text.
</Step>
<Step title="4. Handle errors properly">
Wrap everything in try/catch to handle both network and HTTP errors.
</Step>
</Steps>
```
Pattern 3: Table Snippet (Comparison)
For "[X] vs [Y]" queries:
mdx
undefined
<Steps>
<Step title="1. Call fetch() with the URL">
The `fetch()` function takes a URL and returns a Promise that resolves to a Response object.
</Step>
<Step title="2. Check if the response was successful">
Always verify `response.ok` before processing — fetch doesn't throw on HTTP errors.
</Step>
<Step title="3. Parse the response body">
Use `response.json()` for JSON data, `response.text()` for plain text.
</Step>
<Step title="4. Handle errors properly">
Wrap everything in try/catch to handle both network and HTTP errors.
</Step>
</Steps>
```
模式3:表格类摘要(对比)
针对"[X] vs [Y]"类查询:
mdx
undefined
== vs === in JavaScript
== vs === in JavaScript
Aspect
==
(Loose Equality)
===
(Strict Equality)
Type coercion
Yes — converts types before comparing
No — types must match
Speed
Slower (coercion overhead)
Faster (no coercion)
Predictability
Can produce surprising results
Always predictable
Recommendation
Avoid in most cases
Use by default
javascript
// Examples5=="5"// true (string coerced to number)5==="5"// false (different types)
**Pattern 4: List Snippet (Types/Categories)**
For "types of [concept]" queries:
```mdx
方面
==
(松散相等)
===
(严格相等)
类型转换
是 — 比较前转换类型
否 — 类型必须匹配
速度
较慢(类型转换开销)
较快(无类型转换)
可预测性
可能产生意外结果
始终可预测
推荐
大多数场景避免使用
默认使用
javascript
// 示例5=="5"// true(字符串转换为数字)5==="5"// false(类型不同)
**模式4:列表类摘要(类型/分类)**
针对"types of [concept]"类查询:
```mdx
Types of Scope in JavaScript
Types of Scope in JavaScript
JavaScript has three types of scope that determine where variables are accessible:
Global Scope — Variables declared outside any function or block; accessible everywhere
Function Scope — Variables declared inside a function with
var
; accessible only within that function
Block Scope — Variables declared with
let
or
const
inside
{}
; accessible only within that block
---
JavaScript has three types of scope that determine where variables are accessible:
Global Scope — 在任何函数或块外声明的变量;可在任何地方访问
Function Scope — 用
var
在函数内声明的变量;仅能在该函数内访问
Block Scope — 用
let
或
const
在
{}
内声明的变量;仅能在该块内访问
---
Content Structure for SEO
SEO内容结构
How you structure content affects both rankings and user experience.
The Inverted Pyramid:
Put the most important information first. Search engines and users both prefer content that answers questions immediately.
<Warning>
**Prerequisite:** This guide assumes you understand [Promises](/concepts/promises) and the [Event Loop](/concepts/event-loop). Read those first if you're not comfortable with asynchronous JavaScript.
</Warning>
In Body Content (natural context):
mdx
When the callback finishes, it's added to the task queue — which is managed by the [event loop](/concepts/event-loop).
In Related Concepts Section:
mdx
<CardGroup cols={2}>
<Card title="Promises" icon="handshake" href="/concepts/promises">
async/await is built on top of Promises
</Card>
<Card title="Event Loop" icon="arrows-spin" href="/concepts/event-loop">
How JavaScript manages async operations
</Card>
</CardGroup>
<Warning>
**Prerequisite:** This guide assumes you understand [Promises](/concepts/promises) and the [Event Loop](/concepts/event-loop). Read those first if you're not comfortable with asynchronous JavaScript.
</Warning>
正文内容(自然语境):
mdx
When the callback finishes, it's added to the task queue — which is managed by the [event loop](/concepts/event-loop).
相关概念章节:
mdx
<CardGroup cols={2}>
<Card title="Promises" icon="handshake" href="/concepts/promises">
async/await is built on top of Promises
</Card>
<Card title="Event Loop" icon="arrows-spin" href="/concepts/event-loop">
How JavaScript manages async operations
</Card>
</CardGroup>
锚文本最佳实践:
❌ 糟糕的锚文本
✓ 良好的锚文本
原因
"click here"
"event loop guide"
描述性,包含关键词
"this article"
"our Promises concept"
告诉Google页面内容
"here"
"JavaScript closures"
锚文本包含关键词
"read more"
"understanding the call stack"
自然、信息丰富
URL and Slug Best Practices
URL和Slug最佳实践
URLs (slugs) are a minor but meaningful ranking factor.
Note: For this project, slugs are already set. When creating new pages, follow these conventions.
URL(Slug)是一个次要但有意义的排名因素。
规则:
使用小写 —
closures
而非
Closures
使用连字符 —
call-stack
而非
call_stack
或
callstack
保持简短 — 目标最多3-5词
包含主关键词 — 概念名称
避免停用词 — 除非必要,跳过"the", "and", "in", "of"
Slug示例:
概念
❌ 避免
✓ 使用
The Event Loop
the-event-loop
event-loop
this, call, apply and bind
this-call-apply-and-bind
this-call-apply-bind
Scope and Closures
scope-and-closures
scope-and-closures
(可接受)或
scope-closures
DOM and Layout Trees
dom-and-layout-trees
dom
或
dom-layout-trees
注意: 本项目的Slug已设置完成。创建新页面时,请遵循这些约定。
Opening Paragraph: The SEO Power Move
开篇段落:SEO制胜关键
The opening paragraph is prime SEO real estate. It should:
Hook the reader with a question they're asking
Include the primary keyword naturally
Provide a brief definition or answer
Set up what they'll learn
Template:
mdx
[Question hook that matches search intent?] [Maybe another question?]
The **[Primary Keyword]** is [brief definition that answers "what is X"].
[One sentence explaining why it matters or what it enables].
```javascript
// Immediately show a simple example
[Brief transition to "What you'll learn" box]
**Example (Closures):**
```mdx
Why do some functions seem to "remember" variables that should have disappeared?
How can a callback still access variables from a function that finished running
long ago?
The answer is **closures** — one of JavaScript's most powerful (and often
misunderstood) features. A closure is a function that retains access to its
outer scope's variables, even after that outer scope has finished executing.
```javascript
function createCounter() {
let count = 0 // This variable is "enclosed" by the returned function
return function() {
count++
return count
}
}
const counter = createCounter()
console.log(counter()) // 1
console.log(counter()) // 2 — it remembers!
Understanding closures unlocks patterns like private variables, factory functions,
and the module pattern that power modern JavaScript.
**Why this works for SEO:**
- Question hooks match how people search ("why do functions remember")
- Bold keyword in first paragraph
- Direct definition answers "what is a closure"
- Code example demonstrates immediately
- Natural setup for learning objectives
---
开篇段落是SEO的黄金位置。它应:
用读者正在问的问题吸引他们
自然包含主关键词
提供简短定义或答案
介绍读者将学到的内容
模板:
mdx
[符合搜索意图的问题钩子?] [可能还有另一个问题?]
The **[主关键词]** 是 [回答"X是什么"的简短定义]。
[解释其重要性或作用的一句话]。
```javascript
// 立即展示简单示例
[简短过渡到"你将学到什么"框]
**示例(闭包):**
```mdx
Why do some functions seem to "remember" variables that should have disappeared?
How can a callback still access variables from a function that finished running
long ago?
答案是**闭包** — JavaScript最强大(也常被误解)的特性之一。闭包是指即使外部函数执行完毕,内部函数仍能访问其外部作用域变量的函数。
```javascript
function createCounter() {
let count = 0 // 这个变量被返回的函数"包裹"了
return function() {
count++
return count
}
}
const counter = createCounter()
console.log(counter()) // 1
console.log(counter()) // 2 — 它记住了!
Whenever you introduce a new Web API, method, object, or JavaScript concept, link to MDN immediately. This gives readers a path to deeper learning.
mdx
<!-- ✓ CORRECT: Link on first mention -->
The **[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)** is JavaScript's modern way to make network requests.
The **[Response](https://developer.mozilla.org/en-US/docs/Web/API/Response)** object contains everything about the server's reply.
Most modern APIs return data in **[JSON](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON)** format.
<!-- ❌ WRONG: No links -->
The Fetch API is JavaScript's modern way to make network requests.
<!-- ✓ 正确:首次提及添加链接 -->
The **[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)** 是JavaScript中发起网络请求的现代方式。
The **[Response](https://developer.mozilla.org/en-US/docs/Web/API/Response)** 对象包含了服务器响应的所有信息。
大多数现代API以**[JSON](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON)**格式返回数据。
<!-- ❌ 错误:无链接 -->
The Fetch API是JavaScript中发起网络请求的现代方式。
Link to Related Concept Pages
链接到相关概念页面
When mentioning concepts covered in other pages, link to them:
mdx
<!-- ✓ CORRECT: Internal links to related concepts -->
If you're not familiar with it, check out our [async/await concept](/concepts/async-await) first.
This guide assumes you understand [Promises](/concepts/promises).
<!-- ❌ WRONG: No internal links -->
If you're not familiar with async/await, you should learn that first.
// ✓ GOOD: Start with the absolute basics// This is how you fetch data in JavaScriptconst response =awaitfetch('https://api.example.com/users/1')const user =await response.json()console.log(user.name)// "Alice"
javascript
// ✓ 良好:从最基础的内容开始// 这是你在JavaScript中获取数据的方式const response =awaitfetch('https://api.example.com/users/1')const user =await response.json()console.log(user.name)// "Alice"
2. Use Step-by-Step Comments
2. 使用分步注释
javascript
// Step 1: fetch() returns a Promise that resolves to a Response objectconst responsePromise =fetch('https://api.example.com/users')// Step 2: When the response arrives, we get a Response objectresponsePromise.then(response=>{console.log(response.status)// 200// Step 3: The body is a stream, we need to parse itreturn response.json()}).then(data=>{// Step 4: Now we have the actual dataconsole.log(data)})
// ❌ WRONG - This misses HTTP errors!try{const response =awaitfetch('/api/users/999')const data =await response.json()}catch(error){// Only catches NETWORK errors, not 404s!}// ✓ CORRECT - Check response.oktry{const response =awaitfetch('/api/users/999')if(!response.ok){thrownewError(`HTTP error! Status: ${response.status}`)}const data =await response.json()}catch(error){// Now catches both network AND HTTP errors}
Each resource needs a specific, engaging 2-sentence description explaining what makes it unique. Generic descriptions waste the reader's time.
mdx
<!-- ❌ Generic (bad) -->
<Card title="JavaScript Promises Tutorial" icon="newspaper" href="...">
Learn about Promises in JavaScript.
</Card>
<!-- ❌ Generic (bad) -->
<Card title="Async/Await Explained" icon="newspaper" href="...">
A comprehensive guide to async/await.
</Card>
<!-- ✓ Specific (good) -->
<Card title="JavaScript Async/Await Tutorial" icon="newspaper" href="https://javascript.info/async-await">
The go-to reference for async/await fundamentals. Includes exercises at the end to test your understanding of rewriting promise chains.
</Card>
<!-- ✓ Specific (good) -->
<Card title="JavaScript Visualized: Promises & Async/Await" icon="newspaper" href="...">
Animated GIFs showing the call stack, microtask queue, and event loop in action. This is how async/await finally "clicked" for thousands of developers.
</Card>
<!-- ✓ Specific (good) -->
<Card title="How to Escape Async/Await Hell" icon="newspaper" href="...">
The pizza-and-drinks ordering example makes parallel vs sequential execution crystal clear. Essential reading once you know the basics.
</Card>
Description Formula:
Sentence 1: What makes this resource unique OR what it specifically covers
Sentence 2: Why a reader should click (what they'll gain, who it's best for, what stands out)
All resources are JavaScript-focused (no C#, Python, Java resources)
Each resource has a specific 2-sentence description (not generic)
Resource descriptions explain what makes each unique
No outdated resources (check dates for time-sensitive topics)
4-6 articles from reputable sources
3-4 videos from quality creators
所有文章/视频链接验证可用
所有资源聚焦JavaScript(无C#, Python, Java资源)
每个资源都有具体的2句话描述(非通用)
资源描述解释其独特之处
无过时资源(对时效性强的主题检查日期)
4-6篇来自权威来源的文章
3-4篇来自高质量创作者的视频
Writing Tests
编写测试
When adding code examples, create corresponding tests in
/tests/
:
javascript
// tests/{category}/{concept-name}/{concept-name}.test.jsimport{ describe, it, expect }from'vitest'describe('Concept Name',()=>{describe('Basic Examples',()=>{it('should demonstrate the core concept',()=>{// Convert console.log examples to expect assertionsexpect(typeof"hello").toBe("string")})})describe('Common Mistakes',()=>{it('should show the wrong behavior',()=>{// Test the "wrong" example to prove it's actually wrong})it('should show the correct behavior',()=>{// Test the "correct" example})})})