Statac

Problems explained

Always false

warning A warning says what Statac did instead, and the build goes on.

A template tests whether a page has a field with is defined or is not defined, and no page has a field by that name. A field one slip away is one a page can have, so the name is likely misspelt, and the test gives the same answer on every page: what it guards is never shown, or always shown.

What you’ll see

warning  Always false: no page has `subtitel`
  Did you mean `page.subtitle`?
  More: https://statac.dev/e/always-false/

In the terminal the message also names the file and line where there is one, and marks the exact text.

Why Statac warns

A field no page has yet is often one that later pages will have, so Statac builds the page as written. When the name is one character away from a field pages do have, the test is more likely a slip than a plan, and nothing on the page would show it.

How to fix it

Write the field Statac offers. If the name is right and no page has the field yet, add it to a page, or quieten this warning with quiet: [always-false] in statac.yaml.

Example

In templates/post.html, where posts have a subtitle:

{% if page.subtitel is defined %}
  <p>{{ page.subtitel }}</p>
{% endif %}

The field is subtitle:

{% if page.subtitle is defined %}
  <p>{{ page.subtitle }}</p>
{% endif %}

Its name

Namealways-false
In the terminalstatac explain always-false
To stop showing itquiet: [always-false] in statac.yaml, once you have understood it. Statac still counts it.

Something unclear or wrong? Open an issue on GitHub.