Zola - Validating HTML

10/08/2025, Wed
Categories: #cms

Build Command

Since Zola doesn't have any post build output, one has to rely on checking on the HTML post build output for HTML validness. Once you know the issue that occurs in the HTML, you can work backwards to resolve the problem.

Zola has a build command that will create all the HTML pages for your site.

zola build

The output goes into the public folder in the root of your Zola project.

Install the html-validate npm module globally

npm install -g html-validate

You might also want to create a .htmlvalidate.json file in your project root to silence some HTML validation rules.

For example, these settings disable the no-trailing-whitespace and no-inline-style.

{
  "$schema": "https://html-validate.org/schemas/config.json",
  "extends": ["html-validate:recommended"],
  "rules": {
    "close-order": "error",
    "void-style": "error",
    "void-content": "error",
    "no-trailing-whitespace": "off",
    "no-inline-style": "off"
  }
}

To use html-validate in the CLI follow this syntax

html-validate yourfile.html

For batch verification use the following format

html-validate "public/**/*.html"