How to Add New Pages¶
This guide shows you how to add new pages to your documentation and organize them in the navigation.
Create a New Page¶
- Create a new Markdown file in the
docs/directory or a subdirectory:
- Add content to the file:
- The page will automatically appear in your documentation.
Add Page to Navigation¶
To control where the page appears in the navigation menu:
- Open
mkdocs.yml - Add your page to the
navsection:
nav:
- Home: index.md
- Tutorials:
- Getting Started: tutorials/getting-started.md
- Your New Page: my-new-page.md # Add here
Organize in Subdirectories¶
For better organization, create subdirectories:
- Create a directory structure:
- Create your page in that directory:
- Reference it in navigation:
Add to Diátaxis Structure¶
Follow the Diátaxis framework by placing pages in appropriate directories:
tutorials/- Learning-oriented, hands-on lessonshow-to/- Goal-oriented, problem-solving guidesreference/- Information-oriented, technical descriptionsexplanation/- Understanding-oriented, conceptual discussion
Example:
# Create a tutorial
touch docs/tutorials/build-your-first-api.md
# Create a how-to guide
touch docs/how-to/deploy-to-production.md
# Create reference documentation
touch docs/reference/api-endpoints.md
# Create explanation
touch docs/explanation/architecture-overview.md
Test Your Changes¶
- Start the development server:
- Navigate to your new page
- Verify it appears in the navigation menu as expected
Note
Pages not listed in nav will still be accessible via direct URL but won't appear in the menu.