GitHub Pages 10 ๐ Documentation & Report Portals โ Publishing Docusaurus, VitePress, MkDocs, Storybook, and CI coverage reports
Modern software engineering requires more than just source code; it requires comprehensive documentation and observability. Documentation engines like Docusaurus and VitePress provide the narrative for developers, while Storybook provides a visual catalog for UI components, and coverage reports provide an objective view of code health. GitHub Pages has become the industry-standard hosting layer for these auxiliary artifacts because they are inherently static and tightly coupled with the repository’s lifecycle.
Using GitHub Pages for documentation and reports transforms a repository from a code silo into a transparent development portal. Instead of documentation living in a README or a separate wiki, it lives as a high-performance, searchable website that is automatically updated every time code is merged. This ensures that the “live” documentation never drifts from the actual state of the software. Furthermore, hosting test coverage and performance reports on GitHub Pages allows stakeholders to verify quality without needing access to specialized CI runner outputs.
This chapter covers the specialized configuration and deployment strategies for the most popular documentation frameworks and report generators. We will explore how to manage the unique build requirements of Docusaurus and VitePress, how to host MkDocs for Python-centric projects, and how to set up a multi-path deployment strategy that allows Storybook and test coverage reports to coexist alongside your main documentation.
Key point: GitHub Pages is the optimal hosting solution for documentation and CI reports because it supports the static-export outputs of Docusaurus, MkDocs, and Storybook, allowing for automated, version-controlled documentation portals that update via GitHub Actions.
Why X exists
1. The Information Gap problem.
Code alone rarely explains “why” or “how” to integrate. Documentation portals like Docusaurus exist to bridge this gap, providing a structured way to present tutorials, API references, and conceptual guides that are more accessible than raw source code or basic Markdown files.
2. The Maintenance overhead.
Self-hosting documentation often requires a dedicated server, database, and maintenance schedule. Static site documentation removes this overhead. By using GitHub Pages, the infrastructure is managed by GitHub, leaving the development team to focus solely on the content and the build pipeline.
3. The Consistency problem.
Documentation often becomes outdated the moment it is written. By integrating documentation builds into the CI/CD pipeline, the documentation is treated like code. If a pull request changes an API, the documentation is updated as part of the same transaction, ensuring the two remain in sync.
4. The Visibility of health.
Test coverage reports and Storybook instances are often buried inside CI logs or local development environments. Hosting these on GitHub Pages makes them “first-class citizens” of the project, allowing any team member to browse the UI component library or check the test coverage of a specific branch.
5. The Scalability trade-off.
Dynamic documentation sites (like Wikis) become slow and complex as they grow. Static documentation generators provide near-instant page loads and high searchability (via tools like Algolia) while remaining simple to deploy. This “Jamstack” approach is the most efficient way to scale developer resources.
6. The Searchability benefit.
Modern SSGs like VitePress and Docusaurus generate highly optimized HTML that is easily indexed by search engines. This makes it easier for external developers to find your project’s documentation through search, which is critical for open-source adoption and developer advocacy.
a. Docusaurus and VitePress: The Frontend Documentation Giants
Docusaurus (React-based) and VitePress (Vue/Vite-based) are the dominant players in developer documentation. Both frameworks emphasize a “Markdown-first” approach while allowing developers to embed interactive components.
Docusaurus requires a docusaurus.config.js update to handle GitHub Pages sub-paths. Since most projects are hosted at /repo-name/, the url and baseUrl must be configured correctly to prevent broken CSS/JS links.
// docusaurus.config.js
module.exports = {
title: 'My Project',
url: 'https://username.github.io',
baseUrl: '/my-repo-name/', // Crucial: include leading and trailing slashes
onBrokenLinks: 'throw',
projectName: 'my-repo-name',
organizationName: 'username',
trailingSlash: false,
};
VitePress is significantly faster due to Vite. Its configuration lives in .vitepress/config.js. Like Docusaurus, the base property is the most critical setting for successful deployment.
// .vitepress/config.js
export default {
title: "My Docs",
base: "/my-repo-name/", // Base path for GitHub Pages
themeConfig: {
nav: [{ text: "Home", link: "/" }],
sidebar: [{ text: "Guide", items: [{ text: "Intro", link: "/intro" }] }]
}
}
Both frameworks produce a static folder (build for Docusaurus, .vitepress/dist for VitePress) that is then uploaded via actions/upload-pages-artifact.
b. MkDocs and Storybook: Python Docs and UI Libraries
MkDocs is the standard for Python projects, using the popular “Material for MkDocs” theme. It is configured via a single mkdocs.yml file. Unlike Node-based tools, MkDocs requires a Python environment in your GitHub Actions.
# mkdocs.yml
site_name: My Project Docs
site_url: https://username.github.io/my-repo-name/
theme:
name: material
Storybook is used to document UI components in isolation. It is often deployed as a standalone site or as a subdirectory of the main documentation. To deploy Storybook, you run the build-storybook command, which generates a storybook-static folder.
- name: Build Storybook
run: npm run build-storybook
- name: Upload Storybook
uses: actions/upload-pages-artifact@v3
with:
path: 'storybook-static'
If you want to host both Docusaurus and Storybook, you can use a build script to move the Storybook output into a sub-folder of the Docusaurus build (e.g., build/storybook) before the final upload step.
c. CI Reports and Code Coverage
Hosting test coverage reports (generated by Vitest, Jest, or Istanbul) allows for easy review of code quality. These reports are usually generated as a folder of HTML files.
In a typical Vitest setup, you can generate a coverage folder:
# Example command in CI
npx vitest run --coverage
To make these reports accessible, your GitHub Action can move the coverage output into your documentation’s build folder. This allows you to visit username.github.io/repo/coverage/ to see the line-by-line breakdown.
- name: Generate Coverage
run: npm run coverage
- name: Move Coverage to Docs
run: mv coverage/ ./dist/coverage
- name: Upload Combined Artifact
uses: actions/upload-pages-artifact@v3
with:
path: './dist'
Important: Because coverage reports and documentation engines often use folders starting with underscores (like _next or _assets), you should ensure a .nojekyll file is present in the root of your deployment artifact to prevent GitHub’s legacy Jekyll engine from ignoring those files.
Complete Example Session
# ============================================
# PART 1: THE MULTI-DOC WORKFLOW
# ============================================
name: Deploy Project Portal
on:
push:
branches: ["main"]
permissions:
contents: read
pages: write
id-token: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# ============================================
# PART 2: SETUP ENVIRONMENTS
# ============================================
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
# ============================================
# PART 3: BUILD MAIN DOCUMENTATION (Docusaurus)
# ============================================
- name: Install Dependencies
run: npm ci
- name: Build Docusaurus
run: npm run build # Outputs to ./build
# ============================================
# PART 4: BUILD STORYBOOK (UI Docs)
# ============================================
- name: Build Storybook
run: npm run build-storybook # Outputs to ./storybook-static
# ============================================
# PART 5: RUN TESTS & COVERAGE
# ============================================
- name: Run Tests
run: npm run test:coverage # Outputs to ./coverage
# ============================================
# PART 6: COMBINE ARTIFACTS
# ============================================
- name: Merge Reports into Docs
run: |
mkdir -p build/storybook
mkdir -p build/coverage
cp -r storybook-static/* build/storybook/
cp -r coverage/* build/coverage/
touch build/.nojekyll
# ============================================
# PART 7: UPLOAD COMBINED PORTAL
# ============================================
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './build'
# ============================================
# PART 8: DEPLOY TO PAGES
# ============================================
- name: Deploy
uses: actions/deploy-pages@v4
# ============================================
# PART 9: THE MKDOCS ALTERNATIVE (Python)
# ============================================
# - uses: actions/setup-python@v5
# - run: pip install mkdocs-material
# - run: mkdocs build
# ============================================
# PART 10: VERIFICATION
# ============================================
# Main site: user.github.io/repo/
# Storybook: user.github.io/repo/storybook/
# Coverage: user.github.io/repo/coverage/
This workflow demonstrates the “Portal” pattern, where multiple specialized documentation and report tools are merged into a single static deployment.
Quick Reference
Tool Output Directories
| Tool | Default Folder | Command |
|---|---|---|
| Docusaurus | build | npm run build |
| VitePress | .vitepress/dist | npm run docs:build |
| MkDocs | site | mkdocs build |
| Storybook | storybook-static | npm run build-storybook |
| Vitest/Jest | coverage | npm run test:coverage |
Base Path Settings
| Tool | Config Key | Format |
|---|---|---|
| Docusaurus | baseUrl | '/repo-name/' |
| VitePress | base | '/repo-name/' |
| MkDocs | site_url | 'https://.../repo/' |
| Storybook | --deployment-url | '.../storybook/' |
Comparison: Docusaurus vs VitePress
| Feature | Docusaurus | VitePress |
|---|---|---|
| Base Tech | React | Vue / Vite |
| Speed | Fast | Extremely Fast |
| Versioning | Native Support | Manual / Simple |
| Use Case | Complex Docs | Simple/Clean Docs |
Best Practices
โ Do This:
// Always include leading and trailing slashes in base
baseUrl: '/my-project/' // โ
// Use .nojekyll to ensure underscore folders are served
touch build/.nojekyll // โ
// Combine reports into subfolders of your main docs
cp -r coverage build/coverage // โ
// Set 'onBrokenLinks' to 'throw' in Docusaurus
onBrokenLinks: 'throw' // โ
โ Don’t Do This:
// Don't hardcode absolute URLs in Markdown
[Link](/docs/intro) // โ
// Don't commit build folders (build/, dist/, site/)
// (Add them to .gitignore) // โ
// Don't use the 'Implicit' Jekyll engine for docs
// (Use GitHub Actions instead) // โ
// Don't forget to set 'trailingSlash: false' in Docusaurus
// (Avoids SEO/canonical issues on Pages) // โ
Common Pitfalls
| Pitfall | Why It Happens | Fix |
|---|---|---|
| Broken Styles | baseUrl missing repo name | Update config with /repo-name/ |
| Missing Assets | Jekyll ignores underscore folders | Add .nojekyll file |
| 404 on Refresh | SPA routing mismatch | Use HashRouting or 404.html hack |
| Slow Build | Large images in docs | Use framework-specific image plugins |
| Build Fail (Node) | npm install vs npm ci | Use npm ci for consistent CI builds |
| MkDocs CSS fail | site_url is incorrect | Match site_url exactly to Pages URL |
Real-World Examples
1. Docusaurus Config
const config = { baseUrl: '/awesome-lib/' };
2. VitePress Base
export default { base: '/docs/' };
3. Storybook Subfolder Build
npm run build-storybook -o ./build/storybook
4. Vitest Coverage Command
vitest run --coverage --reporter=html
5. MkDocs Material Install
pip install mkdocs-material mkdocs-git-revision-date-plugin
6. Nojekyll Creation
- run: touch ./dist/.nojekyll
7. GitHub Actions Perms
permissions: { pages: write, id-token: write }
8. MkDocs Build
mkdocs build --clean
9. Conditional Base URL
const baseUrl = process.env.GITHUB_ACTIONS ? '/repo/' : '/';
10. Combination Script
mkdir -p dist && cp -r docs/* dist/ && cp -r coverage dist/
Visual
The Documentation Portal Structure
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ GITHUB PAGES ROOT (/repo-name/) โ
โ โ
โ โโโ index.html (Main Docs - Docusaurus/VitePress) โ
โ โโโ .nojekyll โ
โ โโโ assets/ โ
โ โ โ
โ โโโ storybook/ (UI Components) โ
โ โ โโโ index.html โ
โ โ โ
โ โโโ coverage/ (Test Reports) โ
โ โโโ index.html โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The Build & Merge Pipeline
โโโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโ
โ DOCS BUILDโ โSTORYBOOK โ โ COVERAGE โ
โ (Node) โ โ (Node) โ โ (Vitest) โ
โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโ
โ ./build โ โ ./sb-dist โ โ ./cov-distโ
โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ
โ โ โ
โโโโโโโโโบ MERGE STEP โโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ./final-artifact โ
โ (Upload to GitHub Pages)โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
Asset Path Resolution
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ BASE URL LOGIC โ
โ โ
โ Config: base = "/my-repo/" โ
โ โ
โ Source: <img src="/logo.png"> โ
โ Render: <img src="/my-repo/logo.png"> โ
โ โ
โ (Ensures assets load correctly on GitHub's sub-domains) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Summary
| Item | Value |
|---|---|
| React Engine | Docusaurus |
| Vue/Vite Engine | VitePress |
| Python Engine | MkDocs (Material) |
| Component Docs | Storybook |
| Health Reports | Code Coverage (HTML) |
| Critical Flag | .nojekyll |
| Sub-path Key | baseUrl or base |
Key takeaways:
- GitHub Pages is a portal host. It is not just for one site; you can host documentation, component libraries, and test reports in a single, unified directory structure.
baseUrlis the common point of failure. Documentation engines default to root hosting. You must configure them to understand the repository sub-path.- OIDC makes deployment secure. Use the
permissionsblock in GitHub Actions to avoid manual secrets and leverage GitHub’s native identity for deployment. - Storybook belongs with your docs. Providing a live Storybook instance alongside documentation allows developers to interact with UI components before using them.
- Visibility improves quality. Hosting coverage reports on GitHub Pages makes code health visible to the entire team, encouraging better testing habits.
- Never forget
.nojekyll. Modern tools use underscore-prefixed folders (like_nextor_assets). Without.nojekyll, GitHub Pages will hide these, breaking your site.
Remember: A high-quality software project is defined by the ease with which others can understand and verify it. By automating the publication of Docusaurus, Storybook, and coverage reports to GitHub Pages, you create a professional-grade documentation portal that serves as a single source of truth for developers and stakeholders alike.
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!