Because docmd generates a pure static site, you can host your documentation literally anywhere that serves HTML. Run the build command and serve the output directory (default: site/).
docmd build
The most robust way is using a GitHub Action. This ensures your site rebuilds automatically every time you push.
Create .github/workflows/deploy-docs.yml
name: Deploy docmd
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
- uses: actions/setup-node@v4
with: { node-version: '22', cache: 'npm' }
- run: npm install -g @docmd/core
- run: docmd build
- uses: actions/upload-pages-artifact@v3
with: { path: ./site }
- uses: actions/deploy-pages@v4
- Connect your GitHub repository.
- Under Build Settings:
- Build Command:
npm install -g @docmd/core && docmd build - Output Directory:
site
- Build Command:
- Click Deploy.
- Run
docmd build. - Copy the contents of
site/to your public directory (e.g.,/var/www/html/docs).
docmd’s Single Page Application (SPA) router handles direct URL access gracefully. You do not need complex rewrite rules (like index.html redirects) on your server.
Site URL Configuration
Always ensure your siteUrl is set accurately in docmd.config.js if you are using plugins like sitemap or seo that require absolute URLs.
When deploying to staging or production, run docmd build with the llms plugin active. This ensures that even your staging environments provide AI-consumable context via /llms.txt, allowing your testing agents to verify your documentation accuracy before going live.