CONTENT VALIDATION
ENSURE CONTENT INTEGRITY
Validate content files for syntax errors, missing fields, and broken links before deployment.
VALIDATION COMMAND
Check content integrity
Basic Usage:
BASH
# Validate all content
./fyt validate
# Strict mode (fails on warnings)
./fyt validate --strict
# Validate specific file
./fyt validate content/pages/about.yamlWhat Gets Validated:
✅
YAML syntax validity
✅
Required fields present (meta, title, etc.)
✅
No markdown headings in content fields
✅
Slug uniqueness
✅
Internal link validity
✅
File naming conventions
✅
Indentation consistency
VALIDATION OUTPUT
Understanding results
Success Output:
TEXT
Validating content...
✓ content/pages/about.yaml
✓ content/pages/build.yaml
✓ content/pages/home.yaml
✓ content/blog/2025-01-15-welcome.yaml
4 files valid, 0 errorsError Output:
TEXT
Validating content...
✓ content/pages/about.yaml
✗ content/pages/pricing.yaml
Line 5: Missing required field: meta.description
Line 12: Invalid slug format: /pricing/
Line 25: Inconsistent indentation (expected 2 spaces)
✓ content/pages/home.yaml
2 files valid, 1 file with errorsCOMMON ERRORS
How to fix them
Missing Required Fields:
Error:
Missing required field: meta.descriptionFix:
YAML
meta:
title: "Page Title"
description: "Add description here" # Add this
slug: "/page"Invalid YAML Syntax:
Error:
YAML syntax error: mapping values are not allowed hereFix: Check for missing colons, quotes, or indentation
YAML
# Wrong
title "Page Title"
# Correct
title: "Page Title"Inconsistent Indentation:
Error:
Inconsistent indentation (expected 2 spaces)Fix: Use 2 spaces consistently
YAML
# Wrong (mixed tabs/spaces)
sections:
- id: "section-1"
title: "Title"
# Correct (2 spaces)
sections:
- id: "section-1"
title: "Title"Duplicate Slugs:
Error:
Duplicate slug: /aboutFix: Make slugs unique
YAML
# Change one of the slugs
meta:
slug: "/about-us" # Instead of /aboutMarkdown Headings in Content:
Error:
Markdown heading found in content field: ## HeadingFix: Remove markdown headings, use bold text instead
YAML
# Wrong - redundant heading
content: |
## Command Syntax
Use this command...
# Correct - bold label
content: |
**Command Syntax:**
Use this command...Why: Section titles already provide heading hierarchy. Markdown headings in content create duplicate, conflicting headings.
BROKEN LINK DETECTION
Find and fix broken links
Internal Links:
Validation checks internal links:
YAML
content: |
See [our guide](/docs/guides/print-optimization)Error:
Broken internal link: /docs/guides/missing-pageFix: Update link to existing page or create the page
Link Validation:
BASH
# Validate links
./fyt validate
# Check specific file
./fyt validate content/pages/home.yamlVALIDATION WORKFLOW
Best practices
Before Committing:
BASH
# 1. Edit content
vi content/pages/about.yaml
# 2. Validate
./fyt validate
# 3. Fix errors
vi content/pages/about.yaml
# 4. Validate again
./fyt validate
# 5. Commit when clean
git add content/pages/about.yaml
git commit -m "Update about page"CI/CD Integration:
BASH
# In CI pipeline
./fyt validate --strict
# Fails build if errors foundPre-commit Hook:
BASH
# .git/hooks/pre-commit
#!/bin/bash
./fyt validate --strict
if [ $? -ne 0 ]; then
echo "Validation failed. Fix errors before committing."
exit 1
fiNEXT STEPS
Learn More:
- Editing Content - Edit and validate
- CLI Reference - Complete CLI documentation
- Creating Content - Create valid content
- Deleting Content - Safe deletion