Link Relationships

HTML rel="canonical"

Identifies the preferred URL among equivalent documents. Search engines treat it as a signal, not a guaranteed indexing command; keep redirects, sitemap and canonical signals consistent. The example belongs in a document head; resource URLs are illustrative. Supply actual resources and server configuration to observe network behavior.

Formal Syntax & Structure

html syntaxhtml
<link rel="canonical" href="https://example.com/guide">

Parameters & Attributes

NameTypeDescription
relspace-separated relationship tokensInclude canonical on an element that supports this relationship.
hrefURL or fragmentIdentifies the linked destination or resource.

Working Example

Example Snippethtml
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <title>Example</title>    <link rel="canonical" href="https://example.com/guide">  </head>  <body>    <p>Example document</p>  </body></html>
HTML Reference