Agent Wranglers

WEB-87Recommended

Make every canonical signal agree

Give each page one canonical address, and make the canonical tag, sitemap, Open Graph address, hreflang links and internal links all use exactly that address.

How to do it

Build the canonical from the public origin and the page's path, as an absolute, self-referencing HTTPS address without tracking parameters or a fragment. Put exactly one <link rel="canonical"> in the <head>, because Google ignores it in the body and drops conflicting ones. For non-HTML copies such as Markdown or PDF, send it as a Link: <…>; rel="canonical" header. Use the tag or the header, not both. Never point a canonical at a redirect, a 404 or a noindex page. Don't use noindex or robots.txt to choose a canonical, because they hide the page instead.

Examples

HTML example

<link rel="canonical" href="https://example.com/guides/caching">
<meta property="og:url" content="https://example.com/guides/caching">

HTTP example

link: <https://example.com/guides/caching>; rel="canonical"

How to check

A test reads each page's canonical, og:url and sitemap entry and expects the same address, answering 200 without a redirect. Each page has exactly one canonical tag. The Lighthouse canonical audit passes.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/website/redirects-and-canonicals/canonical-signals">Agent Wranglers website playbook</a>. In code you write, add a comment next to it with the same link.