// This skill creates a complete MkDocs Material project structure for intelligent textbooks. It sets up a Conda virtual environment named 'mkdocs', installs all dependencies, generates mkdocs.yml with all Material theme options, custom CSS for branding, the social_override plugin for custom social media cards, builds the site, and deploys to GitHub Pages. Use this skill when starting a new intelligent textbook project.
| name | install-mkdocs-template |
| description | This skill creates a complete MkDocs Material project structure for intelligent textbooks. It sets up a Conda virtual environment named 'mkdocs', installs all dependencies, generates mkdocs.yml with all Material theme options, custom CSS for branding, the social_override plugin for custom social media cards, builds the site, and deploys to GitHub Pages. Use this skill when starting a new intelligent textbook project. |
This skill creates a complete MkDocs Material project structure optimized for intelligent textbooks.
Create a new Conda environment named mkdocs with Python 3:
conda create -n mkdocs python=3.11 -y
Activate the environment and install MkDocs with Material theme:
conda activate mkdocs
pip install mkdocs mkdocs-material mkdocs-material-extensions pillow cairosvg
The additional packages (pillow, cairosvg) are required for social media card generation.
Before creating files, collect the following information from the user:
Create the following directory structure in the current working directory:
project-root/
├── docs/
│ ├── css/
│ │ └── extra.css
│ ├── img/
│ │ ├── logo.png (placeholder - user must provide)
│ │ └── favicon.ico (placeholder - user must provide)
│ ├── chapters/
│ │ └── index.md
│ ├── learning-graph/
│ │ └── index.md
│ ├── sims/
│ │ └── index.md
│ └── index.md
├── plugins/
│ ├── __init__.py
│ └── social_override.py
├── mkdocs.yml
└── setup.py
Use the template from assets/mkdocs-template.yml as the base. Replace placeholders with user-provided values:
{{SITE_NAME}} - site_name{{SITE_DESCRIPTION}} - site_description{{SITE_AUTHOR}} - site_author{{REPO_NAME}} - repo_name{{SITE_URL}} - site_url{{REPO_URL}} - repo_url{{GOOGLE_ANALYTICS_ID}} - google_analytics_id (remove analytics section if not provided)Use the template from assets/extra.css as the base. Replace the RGB color values with user-provided primary_color_rgb if different from default.
Copy the following files from assets:
assets/plugins/__init__.py → plugins/__init__.pyassets/plugins/social_override.py → plugins/social_override.pyassets/setup.py → setup.pyCreate minimal starter files for each directory:
docs/index.md:
# Welcome to {{SITE_NAME}}
{{SITE_DESCRIPTION}}
## Getting Started
This intelligent textbook is built with MkDocs Material theme.
## Navigation
Use the navigation menu on the left to explore chapters and content.
docs/chapters/index.md:
# Chapters
This section contains the main chapter content of the textbook.
docs/learning-graph/index.md:
# Learning Graph
This section contains the learning graph visualization and concept dependencies.
docs/sims/index.md:
# Interactive Simulations
This section contains MicroSims - interactive educational simulations.
After creating all files, install the social_override plugin in editable mode:
pip install -e .
Build the static site to verify everything is configured correctly:
mkdocs build
This creates a site/ directory with the generated HTML. Check for any build warnings or errors.
To preview the site locally before deploying:
mkdocs serve
The site will be accessible at http://localhost:8000
Deploy the site to GitHub Pages:
mkdocs gh-deploy
This command:
gh-pages branchAfter deployment, provide the user with the live site URL:
https://{{GITHUB_USERNAME}}.github.io/{{REPO_NAME}}/
For example, if the repo_url is https://github.com/dmccreary/my-textbook, the site URL would be:
https://dmccreary.github.io/my-textbook/
Important: The site may take 1-2 minutes to become available after the first deployment. Subsequent deployments are usually faster.
Instruct the user to:
The template includes these Material theme features:
navigation.expand - Expandable navigation sectionsnavigation.path - Breadcrumb navigation pathnavigation.prune - Prune inactive navigation itemsnavigation.indexes - Section index pagesnavigation.top - Back to top buttonnavigation.footer - Previous/next page links in footertoc.follow - Table of contents follows scrollcontent.code.copy - Copy button for code blockscontent.action.edit - Edit on GitHub buttonsearch - Full-text searchsocial - Social media card generationsocial_override - Custom social media images per pagemd_in_html - Markdown inside HTML blocksadmonition - Callout boxes (note, warning, tip, etc.)attr_list - Add HTML attributes to elementspymdownx.details - Collapsible content blockspymdownx.superfences - Enhanced code fencingpymdownx.highlight - Syntax highlighting with line numbersTo use a custom social media image for any page, add frontmatter:
---
title: My Page Title
image: img/my-custom-social-card.png
---
# Page Content Here
The social_override plugin will use the custom image instead of the auto-generated one.
After running the skill, the user must provide:
docs/img/logo.png - Site logo (recommended: 50x50px)docs/img/favicon.ico - Browser faviconHere is the complete sequence of commands for reference:
# Step 1: Create Conda environment
conda create -n mkdocs python=3.11 -y
# Step 2: Activate and install dependencies
conda activate mkdocs
pip install mkdocs mkdocs-material mkdocs-material-extensions pillow cairosvg
# Steps 3-8: Create files (done by Claude)
# Step 9: Install social_override plugin
pip install -e .
# Step 10: Build the site
mkdocs build
# Step 11: Test locally (optional)
mkdocs serve
# Step 12: Deploy to GitHub Pages
mkdocs gh-deploy
# Step 13: Access your site at:
# https://<username>.github.io/<repo-name>/
When returning to work on the textbook in a new terminal session:
conda activate mkdocs
analytics section from mkdocs.yml if not neededblob/master/docs path - adjust if using a different branch