Deployment
Deploy your documentation site to GitHub Pages or GitLab Pages.
GitHub Pages#
Option 1:GitHub Actions (Recommended)#
Create .github/workflows/deploy.yml:
Yaml
name:DeploytoGitHubPageson:push:branches: [main]jobs:deploy:runs-on:ubuntu-lateststeps:-uses:actions/checkout@v3-name:SetupNode.jsuses:actions/setup-node@v4with:node-version:'22'-name:Installdependenciesrun:npminstall-name:Buildrun:npmrunbuild-name:DeploytoGitHubPagesuses:peaceiris/actions-gh-pages@v3with:github_token:${{secrets.GITHUB_TOKEN}}publish_dir:./buildOption 2:Manual Deployment#
Bash
# Build the sitenpm run build# Deploy to gh-pages branchnpx gh-pages -d buildConfiguration for GitHub Pages#
If your repository is at github.com/username/repo,update config.json:
Json
{"baseUrl":"/repo/"}GitLab Pages#
Create .gitlab-ci.yml:
Yaml
image:node:22pages:script:-npminstall-npmrunbuild-mvbuildpublicartifacts:paths:-publiconly:-mainConfiguration for GitLab Pages#
Json
{"baseUrl":"/project-name/"}Custom Domain#
GitHub Pages#
- Add a
CNAMEfile to yourbuilddirectory with your domain - Configure DNS to point to GitHub Pages
- Enable custom domain in repository settings
GitLab Pages#
- Configure DNS to point to GitLab Pages
- Add domain in GitLab Pages settings
Build Optimization#
Before deploying:
- Review all documentation for broken links
- Test the build locally:
npm run build &&npm run serve - Verify responsive design on mobile devices
- Test search functionality
Troubleshooting#
Pages not loading?
- Check
baseUrlinconfig.json - Verify GitHub/GitLab Pages is enabled
- Check build output for errors
Broken links?
- Ensure sidebar items match file paths
- Use correct
baseUrlin configuration