# Validation

URL: /bengal/docs/ship/validate/
Section: validate
Description: Content validation and health checks

---

> For a complete page index, fetch /bengal/llms.txt.

Catch broken links, bad directives, and config drift before they reach production.

Note

Do I need this? Yes when you want automated quality checks in CI or before
deploy. Skip if you are still prototyping locally and fixing issues by hand.
For the full validate-and-fix workflow, see
Validate and Fix (/bengal/docs/ship/validate/validate-and-fix/). For auto-fix,
custom validators, and health configuration, see
Validation Reference (/bengal/docs/ship/validate/validate-and-fix-reference/).

Validate and Fix

Run health checks and automatically fix common content issues

(/bengal/docs/ship/validate/validate-and-fix/)

Validate and Fix Reference

Auto-fix workflows, custom validators, health config, and troubleshooting

(/bengal/docs/ship/validate/validate-and-fix-reference/)

## Validation Flow

flowchart LR
A[Content] --> B[Validators]
B --> C{Issues?}
C -->|Yes| D[Report]
C -->|No| E[Pass]
D --> F{Auto-fixable?}
F -->|Yes| G[Auto-fix]
F -->|No| H[Manual fix needed]

## Quick Start

- Validate (#)

- Auto-fix (#)

- CI/CD (#)

BASH

```
# Run all checks
bengal check

# Validate specific files
bengal check --file content/page.md

# Only validate changed files (incremental)
bengal check --changed

# Verbose output (show all checks)
bengal check --verbose

# Show quality suggestions
bengal check --suggestions

# Watch mode (validate on file changes)
bengal check --watch
```

BASH

```
# Preview fixes
bengal fix --dry-run

# Apply safe fixes
bengal fix

# Apply all fixes including confirmations
bengal fix --all

# Fix specific validator only
bengal fix --validator Directives
```
Fixes common issues:

- Unclosed directive fences

- Invalid directive options

- YAML syntax errors

BASH

```
# Fail build on issues
bengal build --strict

# Validate and exit with error code
bengal check
```
The `--strict`flag makes warnings into errors.

## Built-in Checks

Check
What it validates

`links`
Internal and external links work

`assets`
Asset references exist

`config`
Configuration is valid

`navigation`
Menu structure is correct

`rendering`
Templates render without errors

`cross_ref`
Cross-references are valid

`taxonomy`
Tags and categories are consistent

`directives`
MyST directive syntax is correct

`anchors`
Heading IDs are unique and valid

## Custom Validators

Create project-specific rules by extending`BaseValidator`:

python
PYTHON

```
# validators/custom.py
from bengal.health.base import BaseValidator
from bengal.health.report import CheckResult

class RequireAuthorValidator(BaseValidator):
    """Validator that checks for author field in frontmatter."""

    name = "Author Required"
    description = "Ensures all pages have an author field"

    def validate(self, site, build_context=None):
        results = []
        for page in site.pages:
            if not page.metadata.get("author"):
                results.append(CheckResult.error(
                    f"Missing author in {page.source_path}",
                    recommendation="Add 'author: Your Name' to frontmatter",
                    details=[str(page.source_path)],
                ))
        return results
```

Tip

CI integration: Add`bengal check` to your CI pipeline to catch issues before deployment. Use `--verbose` to see all checks, or `--suggestions`for quality recommendations.

## In This Section

Validate and Fix (/bengal/docs/ship/validate/validate-and-fix/)

Run health checks and automatically fix common content issues

Validate and Fix Reference (/bengal/docs/ship/validate/validate-and-fix-reference/)

Auto-fix workflows, custom validators, health config, and troubleshooting

Related Pages

Structure (/bengal/docs/build-sites/structure/)

Organize pages, collections, i18n, versioning, and site analysis

Related

Build Sites (/bengal/docs/build-sites/)

Write, structure, customize, and extend your Bengal site

Related

Tutorials (/bengal/docs/tutorials/)

Step-by-step guides for building with Bengal

Related

User Scenarios (/bengal/docs/tutorials/user-scenarios/)

Common use cases and patterns for different types of Bengal sites

Related

Specialized Site Scenarios (/bengal/docs/tutorials/user-scenarios-specialized/)

i18n, landing pages, resume, and changelog site patterns

Related

persona-operator (/bengal/tags/persona-operator/)

persona-writer (/bengal/tags/persona-writer/)
