Stand up metadata validation for your repo
You own a docs repo, and you want every page to carry correct, complete frontmatter so search and your content catalog stay trustworthy. This guide threads the whole setup together: install docmeta, validate a folder by hand, capture your rules in a docmeta.config.yaml, then land a CI gate that runs the same check on every pull request.
By the end you will have a committed config file and a check that fails the build when a doc is missing required metadata.
Before you start
Section titled “Before you start”- Node.js 24 or newer. Check with
node --version. - A docs repo with frontmatter you want to enforce. The examples below assume Markdown under a
docs/folder, but docmeta handles other formats too — see the supported formats reference.
Stand it up
Section titled “Stand it up”-
Validate a folder, no setup required.
Run docmeta against a directory with
npx. No install, no config — this tells you where you stand today.Terminal window npx docmeta validate docs/docmeta walks
docs/, finds every supported file, and validates each one against the built-ingoogle:okf:0.1schema, which requires atypefield. You will see a pass/fail line per file and a summary. A nonzero exit code means at least one file failed. -
Add a
docmeta.config.yamlat your repo root.The command above works, but you do not want to retype paths and schemas every run — and CI needs a stored definition of what “valid” means for your repo. Capture it in a config file so a bare
docmeta validateknows what to do.docmeta.config.yaml # Default targets when no paths are passed on the command line.paths:- "docs/**/*.md"# The schema set every matched file must satisfy.schemas:- google:okf:0.1pathsis the fallback docmeta uses when you do not name files on the command line.schemasis the set each file is validated against — every file must satisfy every schema you list.Create your docmeta.config.yamlEvery config key explained — paths, exclude, schemas, and overrides — with a complete worked example. -
Run the stored configuration.
With the config committed, you no longer pass paths or schemas. docmeta discovers
docmeta.config.yamlin the current directory and uses itspathsandschemas.Terminal window npx docmeta validateThis is the exact command CI will run. Confirm it reports what you expect locally before you wire it up.
-
Land the CI gate.
The same
npx docmeta validatecommand becomes a pull-request gate. docmeta exits0when everything passes and1when a file fails validation, so any CI system can use it as a pass/fail step. The--format githubflag turns failures into inline annotations on the PR diff.Terminal window npx -y docmeta validate --format githubThe full recipe — workflow file, exit-code contract, and annotation behavior — lives in the CI track. Copy the ready-made recipe there rather than assembling your own.
Run it in CIReady-made recipes for GitHub Actions, GitLab CI, Jenkins, and pre-commit, plus the exit-code and annotation contract.
What you have now
Section titled “What you have now”A committed docmeta.config.yaml that defines which files to check and which schema they must satisfy, plus a CI step that runs the same check on every pull request and fails the build on bad metadata. New contributors get the same enforcement you do, without any review fatigue on your side.