MkDocs Awesome Pages Plugin Guide¶
A practical guide for configuring MkDocs with the awesome-pages plugin based on real-world implementation experience.
Overview¶
The awesome-pages plugin simplifies MkDocs navigation by auto-discovering your file structure and creating navigation automatically. The key insight: less configuration is better - let the plugin do the work for you.
Key Principles¶
1. Use ... in mkdocs.yml nav section¶
The main mkdocs.yml must use the rest operator (...) to let awesome-pages take control:
❌ Don't do this - Defining complete navigation in mkdocs.yml prevents awesome-pages from working:
nav:
- Home: index.md
- Getting Started:
- Overview: getting-started/overview.md
- Setup: getting-started/setup.md
# ... more manual entries
2. Minimal .pages files for basic control¶
Use .pages files sparingly and keep them simple:
Root level: /docs/.pages (optional)¶
Directory level: /docs/guides/.pages (minimal approach)¶
⚠️ Avoid complex nested structures - they often cause path resolution issues.
3. Let Auto-Discovery Work¶
The plugin automatically:
- Converts directory names to navigation sections (e.g., architecture/ → "Architecture")
- Uses index.md as the landing page for directories
- Alphabetically orders files and directories by default
- Follows file structure to create logical hierarchy
Working Configuration Examples¶
Minimal Approach (Recommended)¶
docs/
├── .pages # Optional: basic order control
├── index.md
├── about.md
├── getting-started/
│ ├── index.md # Landing page (auto-discovered)
│ ├── overview.md # Auto-discovered
│ └── setup.md # Auto-discovered
└── guides/
├── .pages # Optional: show overview first
├── index.md # Overview page
├── architecture/ # Auto-discovered as "Architecture"
│ ├── index.md # Architecture overview
│ ├── phase-1.md # Auto-discovered
│ └── phase-2.md # Auto-discovered
└── data-analysis.md # Auto-discovered
Minimal .pages Files¶
# docs/.pages (optional - only if you want specific order)
nav:
- index.md
- getting-started
- guides
- about.md
# docs/guides/.pages (optional - only to show overview first)
title: Guides
nav:
- index.md # Overview first
- ... # Everything else auto-discovered
What You DON'T Need¶
# ❌ Don't manually list everything
nav:
- Architecture:
- Overview: architecture/index.md
- Phase 1: architecture/phase-1-experiment.md
- Phase 2: architecture/phase-2-productionalize.md
# This is too complex and causes path issues!
Common Issues and Solutions¶
Issue: "Pages exist but are not included in nav configuration"¶
Symptom: MkDocs warns about pages not being included.
Root Cause: Too much configuration! Over-defining .pages files prevents auto-discovery.
Solution:
1. Simplify or remove most .pages files
2. Let awesome-pages auto-discover your content
3. Only use .pages files when you need specific ordering
Issue: Broken navigation links (404 errors)¶
Symptom: Navigation links point to wrong URLs (e.g., /architecture/ instead of /guides/architecture/).
Root Cause: Complex nested navigation in .pages files causes path resolution conflicts.
Solution:
1. Remove complex .pages files in subdirectories
2. Use simple directory references: - architecture not - Architecture: architecture/
3. Let the plugin handle path resolution automatically
Issue: "Absolute path to '/...' is included in nav"¶
Symptom: Warning about absolute paths in navigation.
Cause: The ... rest operator in .pages files.
Solution: This is expected behavior - the warning can be safely ignored.
Plugin Configuration¶
Enable the plugin in mkdocs.yml:
Optional configuration:
plugins:
- awesome-pages:
filename: .pages # Default: .pages
collapse_single_pages: true # Collapse single-item directories
strict: false # Don't fail on missing files
Best Practices¶
1. Start with No Configuration¶
Let awesome-pages auto-discover everything first. Only add .pages files if you need specific ordering.
2. Use index.md for Directory Landing Pages¶
Create index.md files in directories to provide overview pages:
guides/
├── index.md # Guides overview
├── architecture/
│ ├── index.md # Architecture overview
│ ├── phase-1.md
│ └── phase-2.md
3. Keep .pages Files Minimal¶
When you do need .pages files, keep them simple:
4. Trust Auto-Discovery¶
The plugin is smart about: - Converting filenames to readable titles - Organizing content logically - Creating proper URL paths
5. Test Locally¶
Always test with mkdocs serve to catch issues early.
Migration from Manual Navigation¶
If migrating from manual mkdocs.yml navigation:
- Save your current nav structure - document the intended hierarchy
- Replace nav with
...inmkdocs.yml - Create root
.pageswith simple directory/file references - Create directory
.pagesfiles for each section - Test and iterate until navigation matches your intended structure
Troubleshooting¶
Debug Navigation Issues¶
- Check MkDocs build output - warnings often indicate the exact issue
- Verify file paths - ensure all referenced files exist
- Test incrementally - start with basic structure and add complexity
- Use MkDocs serve - live reload helps identify issues quickly
Common File Path Issues¶
# ❌ Wrong - file doesn't exist
nav:
- Guide: guide.md
# ✅ Correct - file exists at this path
nav:
- Guide: data-analysis.md
Validation Checklist¶
-
mkdocs.ymlusesnav: - ... - Root
.pagesfile exists with basic structure - All referenced files/directories exist
- Directory
.pagesfiles havetitleandnavsections - File paths are relative to the directory containing the
.pagesfile - No duplicate entries across
.pagesfiles
Conclusion¶
The awesome-pages plugin works best when you embrace auto-discovery:
- Less is more - minimal configuration works better than complex
.pagesfiles - Trust the plugin - it's designed to organize content intelligently
- Use
index.mdfiles - provide overview pages for directories - Test locally - catch issues early with
mkdocs serve
Key Insight: The plugin's strength is auto-discovery. Fighting it with complex configuration causes more problems than it solves.
This minimal approach scales excellently for large documentation sites and requires almost no maintenance.