This repository has a comprehensive validation system to catch errors before they reach production. The same validation checks run both locally (via makefile) and in CI/CD (via GitHub Actions), ensuring consistency.
Run all validation checks locally:
make check-allOr run a quick validation (skips external link checks):
make check-quick- Validates that all markdown files have valid YAML front matter
- Catches syntax errors in the
---delimited front matter sections - Uses
yqto parse and validate YAML
- Ensures all documentation pages have required fields:
title: Page titledescription: Page descriptionicon: Page icon
- Warns if any required fields are missing
- Builds the Hugo site with strict validation flags:
--printPathWarnings: Show path warnings--printUnusedTemplates: Show unused templates--templateMetrics: Show template performance metrics--templateMetricsHints: Show optimization hints
- Checks the built site for common issues:
- Raw HTML omitted: Unsupported HTML in markdown
- ZgotmplZ: Template execution errors (CRITICAL)
- Missing translations: i18n placeholders
- Nil pointer references: Template nil pointer errors (CRITICAL)
- Validates that translations are in sync
- Uses
npm run translate:check - Ensures all languages have the same keys
- Validates doclink shortcodes
- Uses
npm run doclinks:check - Ensures internal cross-references are valid
- Checks markdown files for broken internal links
- Validates relative links point to existing files
- May have false positives with Hugo-specific paths
- Checks external URLs for dead links
- Uses
htmltesttool (auto-installs if needed) - Caches results to speed up repeated runs
- Can be slow, so excluded from
validate-quick
- Validates that all image references point to existing files
- Checks for orphaned images in
static/directory - Supports relative and absolute image paths
- Warns if TODO or FIXME comments are found in content
- Helps catch unfinished work before merging
You can run individual validation checks:
# Just check front matter
make check-frontmatter
# Just check images
make check-images
# Just check translations
make check-translationsThe GitHub Actions workflow (.github/workflows/pr-checks.yml) runs the same makefile targets, ensuring:
- No Logic Duplication: All validation logic lives in the makefile
- Consistency: Local and CI validation are identical
- Easy Testing: Test CI behavior locally before pushing
- Maintainability: Update validation in one place
The workflow runs on every pull request to main.
- Hugo (extended version):
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest - yq: For YAML validation (install instructions)
- Node.js & npm: For translation and doclink validation
- htmltest: For external link checking (auto-installs in makefile)
Install all dependencies:
make setupThis will:
- Install npm dependencies
- Install Hugo (extended)
- Check for yq (with install instructions if missing)
Install yq:
- macOS:
brew install yq - Linux:
wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 chmod +x /usr/local/bin/yq
Run npm install in the repository root.
The makefile will attempt to auto-install it. If that fails:
- macOS:
brew install htmltest - Linux: Download from htmltest releases
Make sure you have npm dependencies installed: npm install
If you need to actually translate content (not just validate), you'll need:
export DEEPL_API_KEY=your-api-key
make translate-
Run validation before committing:
make check-quick # Fast check before every commit -
Run full validation before creating PR:
make check-all # Complete check before PR -
Fix errors immediately: Don't let validation errors accumulate
-
Use individual checks during development: If working on images, just run
make check-images -
Keep dependencies updated: Regularly run
make setup
To add a new validation check:
-
Add a makefile target in the "VALIDATION CHECKS" section:
validate-my-check: @echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" @echo "Running my validation check..." @echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" # Your validation logic here @echo "✅ My check passed" @echo ""
-
Add to
validate-alltarget:validate-all: ... validate-my-check -
Add to GitHub Actions (
.github/workflows/pr-checks.yml):- name: Run my validation check run: make check-my-check
-
Update help text in makefile
-
Document in this file
validate-quick: ~30 seconds (no external link checks)validate-all: 2-5 minutes (includes external link checks)- Individual checks: 5-30 seconds each
External link checking is cached, so repeated runs are faster.
If you encounter issues with validation:
- Check this documentation
- Run individual checks to isolate the problem
- Check the makefile for the exact commands being run
- Review GitHub Actions logs for CI failures
- Open an issue with details of the validation error
The validation system helps maintain high quality documentation by:
- ✅ Catching errors early in development
- ✅ Ensuring consistency across the site
- ✅ Validating content, structure, and references
- ✅ Matching local and CI/CD validation exactly
- ✅ Providing fast feedback to developers
- ✅ Making the review process smoother
Run make help to see all available commands.