MDX Notes
How to make your MDX docs show up in search results — keywords, meta tags, headings, internal links, and technical SEO that actually works.
You wrote great docs. Now people need to actually find them. MDX renders to HTML, which search engines already understand — but there's a lot you can do to push your content higher in rankings.
Why SEO Matters for Documentation
Your docs are competing with every other result on page one. If Google can't index and rank your pages properly, developers searching for answers will never land on your site. Better SEO = more readers, more contributors, more adoption.
Keyword Placement Strategy
Put your keywords where search engines look first:
Primary Keyword Locations
# Installing MDX with Next.js {/* ← H1 contains primary keyword */}
Learn how to **install MDX** in your {/* ← First paragraph, bolded */}
Next.js application with full configuration
options and plugin support.
## Prerequisites for MDX Installation {/* ← H2 with keyword variation */}
## Step-by-Step MDX Setup {/* ← Another H2 with variation */}Keyword Density Guidelines
- Title/H1: Include primary keyword naturally
- First 100 words: Mention the primary keyword once
- Headings: Use keyword variations in 30–50% of H2s
- Body text: 1–2% keyword density (don't stuff)
- Image alt text: Include keywords where natural
- URL/slug: Include primary keyword
Heading Structure for SEO
Search engines read your headings to figure out what your page is about and how it's organized:
{/* ✅ SEO-optimized heading structure */}
# How to Use MDX Components in React {/* Clear, keyword-rich H1 */}
## What Are MDX Components? {/* Targets featured snippet */}
## Creating Your First MDX Component {/* Action-oriented, specific */}
### Props and Configuration {/* Logical sub-topic */}
### Styling MDX Components {/* Related sub-topic */}
## Advanced MDX Component Patterns {/* Signals depth of content */}
## Troubleshooting Common Issues {/* Captures error-related searches */}
{/* ❌ Poor heading structure for SEO */}
# Components
## About
## Usage
## More InfoHeading Best Practices for SEO
| Practice | Example |
|---|---|
| Include target keyword | "Configuring MDX Plugins" not "Configuration" |
| Use question format | "How Do MDX Plugins Work?" (targets voice search) |
| Be specific | "MDX Remark Plugin Setup" not "Setup" |
| Match search intent | "Fix MDX Build Errors" (matches what users search) |
| Keep under 60 chars | Displays fully in search results |
Meta Tags and Frontmatter
Your frontmatter controls what shows up in search results and social shares:
Meta Tag Optimization Rules
- Title: 50–60 characters, keyword at the beginning
- Description: 150–160 characters, include a call to action
- Canonical URL: Prevent duplicate content issues
- Open Graph: Control social sharing appearance
- Keywords: Include 3–5 relevant terms
Internal Linking Strategy
Internal links spread page authority around your site and help crawlers find your content:
Internal Linking Rules
- 3–5 internal links per page minimum
- Descriptive anchor text — tells users and search engines what's at the destination
- Link to deep pages — not just the homepage
- Contextual relevance — link where it makes sense in the content flow
- Update old content — add links to new pages from existing content
URL Structure
Clean URLs help both search engines and humans:
URL Guidelines
- Use kebab-case:
/custom-componentsnot/customComponents - Keep URLs short: 3–5 words after domain
- Include target keyword in the slug
- Avoid date-based URLs for evergreen content
- Limit nesting depth to 3 levels maximum
- Use trailing slashes consistently (pick one approach)
Image Alt Text
Every image needs descriptive alt text. No exceptions:
Schema Markup
Structured data helps search engines show rich results (those fancy snippets with ratings, dates, etc.):
export function ArticleSchema({ title, description, date, author }) {
const schema = {
"@context": "https://schema.org",
"@type": "TechArticle",
"headline": title,
"description": description,
"datePublished": date,
"author": {
"@type": "Person",
"name": author
},
"publisher": {
"@type": "Organization",
"name": "MDX Tutorial"
}
};
return (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
/>
);
}import { ArticleSchema } from '../components/ArticleSchema';
<ArticleSchema
title="MDX Components Guide"
description="Learn to create and use custom components in MDX"
date="2024-01-15"
author="MDX Tutorial Team"
/>
# MDX Components Guide
...Sitemap Generation
Make sure search engines can find all your pages:
Page Speed Optimization
Google cares about speed. Slow pages rank lower. Here's what to do in your MDX:
MDX-Specific Performance Tips
Performance Checklist
- [ ] Images optimized and properly sized
- [ ] Lazy loading for below-fold content
- [ ] Minimal JavaScript bundle
- [ ] Static generation where possible (SSG over SSR)
- [ ] CDN for assets
- [ ] Compressed responses (gzip/brotli)
- [ ] Minimal third-party scripts
Content Freshness
Search engines reward pages that get updated. Stale content drops in rankings over time.
- Review quarterly — Update statistics, links, and examples
- Add "last updated" dates — Show search engines content is maintained
- Expand existing content — Add sections rather than creating thin new pages
- Fix broken links — Regularly audit and repair link rot
- Update code examples — Keep dependencies current
---
title: "MDX Configuration Guide"
date: "2024-01-15"
lastUpdated: "2024-03-20" {/* ← Track when content was refreshed */}
---Summary
SEO for MDX boils down to this: help search engines understand your content, and make it fast to load. Clear structure, strategic keywords, good performance, regular updates. But honestly, the single best thing you can do for SEO is write content that genuinely helps people. Everything else is just optimization on top of that.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for SEO Optimization for MDX Content.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this MDX Tutorial topic.
Search Terms
mdx-tutorial, mdx tutorial, mdx, tutorial, best, practices, seo, for
Related MDX Tutorial Topics