Rules / site rules

site.canonical.exists

Default
error
Plugin
site

A canonical link to the site points to a page of the build.

Why: A canonical link asks search engines to show its target instead of the page. When the target does not exist, the page points search engines to an error page, and they may ignore the canonical link. This is often a renamed page, or a typo in a template.

The rule reads the files of a linted folder, so it does not run for single files and URLs, and it needs a host. Canonical links to other origins are skipped.

When off: canonical links to missing pages pass.

<!-- For a build without old/index.html -->

<!-- ✗ Fails -->
<link rel="canonical" href="https://example.com/old/" />

References