Why does Astro Canonical exist?
Canonical URL errors are often invisible until SEO damage is done. Astro Canonical makes canonical correctness non-optional by enforcing it at build time.
Astro & SEO
Clear answers explaining how Astro Canonical enforces canonical URL correctness at build time.
Canonical URL errors are often invisible until SEO damage is done. Astro Canonical makes canonical correctness non-optional by enforcing it at build time.
No. The plugin runs exclusively during astro build and produces no runtime code.
Each HTML page must include a canonical tag, the URL must be absolute, must start with the configured site, and must respect trailing-slash rules if configured.
astro-canonical reads your trailingSlash setting from astro.config.mjs and enforces canonical URLs to match it exactly.
If trailingSlash is not set, the plugin enforces canonical presence, absolute URLs, and site matching but does not enforce trailing-slash rules.
No. 404.html files are ignored automatically.
The build fails immediately and prints a detailed summary of invalid canonicals.
A clear build-time summary listing the site, trailing-slash policy, files scanned, and any invalid canonicals found.
No. Astro Canonical only validates output — it never modifies HTML.
Yes. Astro Canonical is fully open source and released under the MIT license.
Want to try it yourself? Astro Canonical plugin or Astro Security plugin or Astro IndexNow plugin
Ready to enforce canonical correctness in your Astro project?