Claude-skill-registry install-mkdocs-template
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.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/install-mkdocs-template" ~/.claude/skills/majiayu000-claude-skill-registry-install-mkdocs-template && rm -rf "$T"
skills/data/install-mkdocs-template/SKILL.mdInstall MkDocs Template
This skill creates a complete MkDocs Material project structure optimized for intelligent textbooks.
What This Skill Creates
- mkdocs.yml - Complete configuration with all Material theme options
- docs/css/extra.css - Custom CSS with branding color variables
- docs/img/ - Directory for logo and favicon
- plugins/ - Social override plugin for custom social media cards
- setup.py - Plugin installation configuration
- docs/index.md - Home page template
Prerequisites
- Conda (Miniconda or Anaconda) installed
- Git repository initialized with remote origin configured
- GitHub repository created (for GitHub Pages deployment)
Workflow
Step 1: Create Conda Environment
Create a new Conda environment named
mkdocs with Python 3:
conda create -n mkdocs python=3.11 -y
Step 2: Activate Environment and Install Dependencies
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.
Step 3: Gather Project Information
Before creating files, collect the following information from the user:
- site_name - The title of the textbook (e.g., "Introduction to Machine Learning")
- site_description - A brief description for SEO and social sharing
- site_author - Author name(s)
- repo_name - GitHub repository display name (default: "GitHub Repo")
- site_url - Full URL where the site will be hosted (e.g., "https://username.github.io/repo-name/")
- repo_url - GitHub repository URL
- primary_color_rgb - Primary brand color as RGB values (default: 218, 120, 87 - Anthropic brown)
- google_analytics_id - Optional Google Analytics property ID
Step 4: Create Directory Structure
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
Step 5: Create mkdocs.yml
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 (remove analytics section if not provided){{GOOGLE_ANALYTICS_ID}}
Step 6: Create extra.css
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.
Step 7: Create Social Override Plugin
Copy the following files from assets:
→assets/plugins/__init__.pyplugins/__init__.py
→assets/plugins/social_override.pyplugins/social_override.py
→assets/setup.pysetup.py
Step 8: Create Starter Content Files
Create 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.
Step 9: Install the Social Override Plugin
After creating all files, install the social_override plugin in editable mode:
pip install -e .
Step 10: Build the Site
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.
Step 11: Test Locally (Optional)
To preview the site locally before deploying:
mkdocs serve
The site will be accessible at http://localhost:8000
Step 12: Deploy to GitHub Pages
Deploy the site to GitHub Pages:
mkdocs gh-deploy
This command:
- Builds the site
- Creates/updates the
branchgh-pages - Pushes to GitHub
- Configures GitHub Pages to serve from that branch
Step 13: Provide the GitHub Pages URL
After 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.
Step 14: Verify Deployment
Instruct the user to:
- Visit the GitHub Pages URL
- Check that the home page loads correctly
- Verify navigation works
- Test on mobile devices for responsive layout
MkDocs Material Features Included
The template includes these Material theme features:
Navigation
- Expandable navigation sectionsnavigation.expand
- Breadcrumb navigation pathnavigation.path
- Prune inactive navigation itemsnavigation.prune
- Section index pagesnavigation.indexes
- Back to top buttonnavigation.top
- Previous/next page links in footernavigation.footer
- Table of contents follows scrolltoc.follow
Content
- Copy button for code blockscontent.code.copy
- Edit on GitHub buttoncontent.action.edit
Plugins
- Full-text searchsearch
- Social media card generationsocial
- Custom social media images per pagesocial_override
Markdown Extensions
- Markdown inside HTML blocksmd_in_html
- Callout boxes (note, warning, tip, etc.)admonition
- Add HTML attributes to elementsattr_list
- Collapsible content blockspymdownx.details
- Enhanced code fencingpymdownx.superfences
- Syntax highlighting with line numberspymdownx.highlight
Customizing Social Media Cards
To 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.
Logo and Favicon
After running the skill, the user must provide:
- Site logo (recommended: 50x50px)docs/img/logo.png
- Browser favicondocs/img/favicon.ico
Quick Reference - All Commands
Here 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>/
Reactivating the Environment
When returning to work on the textbook in a new terminal session:
conda activate mkdocs
Notes
- The template uses a custom primary color defined in CSS rather than Material's built-in palette
- Google Analytics is optional - remove the
section from mkdocs.yml if not neededanalytics - The edit_uri points to the
path - adjust if using a different branchblob/master/docs - The Conda environment is reusable across multiple MkDocs projects
- First deployment may take 1-2 minutes to appear on GitHub Pages