rel-canonical: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
No edit summary
m (Replace <entry-title> with {{DISPLAYTITLE:}})
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{stub}}
{{DISPLAYTITLE:rel-canonical}}
<span class="h-card vcard"><span class="p-name fn">[[User:Kevin Marks|Kevin Marks]]</span> (<span class="p-role role">Editor</span>)</span>
----
<dfn style="font-style:normal;font-weight:bold">rel=canonical</dfn> is a link relation to indicate the canonical URL of the current page, to avoid duplicate content.


rel=canonical is a link relation to indicate the canonical URL of the current page.
{{cc0-owfa-license}}
 
== Abstract ==
<p class="entry-summary">By adding <code>rel="canonical"</code> to a hyperlink, a page indicates that the destination of that hyperlink {{should}} be considered the preferred or definitive version of the current page. This helps search engines avoid duplicate content, and is useful for deciding how to link to a page when citing it.</p>
 
== Discussion ==
There are many reasons for a site to serve the same content at multiple URLs, but duplicate pages are undesirable in search results. The [https://www.mattcutts.com/blog/seo-advice-url-canonicalization/ historic recommendation] was to use 301 redirects to the canonical page, but that can be jarring for users. There are many use cases for a URL to have additional information added as query parameters or fragments to indicate the navigation history for referral purposes, but would prefer a single main referent from searches. This  was codified in February 2009 as rel=canonical, and [https://webmasters.googleblog.com/2009/02/specify-your-canonical.html adopted] by [http://www.ysearchblog.com/2009/02/12/fighting-duplication-adding-more-arrows-to-your-quiver/ many] [https://blogs.msdn.microsoft.com/webmaster/archive/2009/02/12/partnering-to-help-solve-duplicate-content-issues.aspx search] [https://web-beta.archive.org/web/20091008070823/http://blog.ask.com/2009/02/ask-is-going-canonical.html engines].
 
Search engines prefer <code>rel=canonical</code> on a <code>&lt;link&gt;</code> element, and will [https://www.mattcutts.com/blog/rel-canonical-html-head/ ignore it] on an <code>&lt;a&gt;</code> element.
=== Cross-domain links ===
Although the primary use case is links within the same domain, rel=canonical can be used [https://webmasters.googleblog.com/2009/12/handling-legitimate-cross-domain.html across domains] too. A common use case recently is from [https://www.ampproject.org/docs/guides/deploy/discovery cached AMP pages] to their original.
== The opposite of canonical ==
There are several ways of indicating non-canonical versions of a page, depending on what is intended. A non-comprehensive list
=== rel-syndication and u-syndication ===
[[rel-syndication]] and [http://microformats.org/wiki/h-entry#Core_Properties u-syndication] link to copies that the author has syndicated or shared onto other sites. The syndicated copies {{should}} have a rel-canonical link back to the original if the other site allows it.
=== rel-alternate===
[[rel-alternate]] is used to link to versions of the page in other forms, whether a different format with <code>type</code>, language with <code>hreflang</code> or presentation medium with <code>media</code>.
=== rel-amphtml ===
[[rel-amphtml]] is used to link to the Accelerated Mobile Pages version, a html subset limiting javascript, replacing built-in elements with custom elements and designed for caching. It is [https://www.ampproject.org/docs/guides/deploy/discovery recommended] to link back from the AMP version to the original with rel-canonical
 
=== rel-shortlink ===
[[rel-shortlink]] is used to link to a url shortened version designed for sharing and (often) tracking.
=== rel-me ===
[[rel-me]] is explicitly saying that another domain or page  represents the same person or organisation as the current page. As such it is a different level of abstraction from rel-canonical, as it refers to the representation rather than the content.
=== rev-canonical ===
A deprecated way of linking to a short link, briefly [https://revcanonical.wordpress.com/ popular], [https://www.mnot.net/blog/2009/04/14/rev_canonical_bad disliked] and not recommended.
 
== Issues ==
* See https://github.com/whatwg/html/issues/2351


== See Also ==
== See Also ==
* [[existing-rel-values]]
* [[existing-rel-values]]
* https://en.wikipedia.org/wiki/Canonical_link_element
* https://en.wikipedia.org/wiki/Canonical_link_element
* [https://support.google.com/webmasters/answer/139066?hl=en  Google's canonical advice page]
* [http://known.kevinmarks.com/2017/day-7-to-amp-or-not-to-amp-100daysofindieweb canonical bookmarklets]
* [[sharelink-formats]]
* [https://tools.ietf.org/html/rfc6596 RFC 6596 - The Canonical Link Relation]

Latest revision as of 16:31, 18 July 2020

Kevin Marks (Editor)


rel=canonical is a link relation to indicate the canonical URL of the current page, to avoid duplicate content.

Per CC0, to the extent possible under law, the editors have waived all copyright and related or neighboring rights to this work. In addition, as of 2024-11-22, the editors have made this specification available under the Open Web Foundation Agreement Version 1.0.

Abstract

By adding rel="canonical" to a hyperlink, a page indicates that the destination of that hyperlink SHOULD be considered the preferred or definitive version of the current page. This helps search engines avoid duplicate content, and is useful for deciding how to link to a page when citing it.

Discussion

There are many reasons for a site to serve the same content at multiple URLs, but duplicate pages are undesirable in search results. The historic recommendation was to use 301 redirects to the canonical page, but that can be jarring for users. There are many use cases for a URL to have additional information added as query parameters or fragments to indicate the navigation history for referral purposes, but would prefer a single main referent from searches. This was codified in February 2009 as rel=canonical, and adopted by many search engines.

Search engines prefer rel=canonical on a <link> element, and will ignore it on an <a> element.

Cross-domain links

Although the primary use case is links within the same domain, rel=canonical can be used across domains too. A common use case recently is from cached AMP pages to their original.

The opposite of canonical

There are several ways of indicating non-canonical versions of a page, depending on what is intended. A non-comprehensive list

rel-syndication and u-syndication

rel-syndication and u-syndication link to copies that the author has syndicated or shared onto other sites. The syndicated copies SHOULD have a rel-canonical link back to the original if the other site allows it.

rel-alternate

rel-alternate is used to link to versions of the page in other forms, whether a different format with type, language with hreflang or presentation medium with media.

rel-amphtml

rel-amphtml is used to link to the Accelerated Mobile Pages version, a html subset limiting javascript, replacing built-in elements with custom elements and designed for caching. It is recommended to link back from the AMP version to the original with rel-canonical

rel-shortlink

rel-shortlink is used to link to a url shortened version designed for sharing and (often) tracking.

rel-me

rel-me is explicitly saying that another domain or page represents the same person or organisation as the current page. As such it is a different level of abstraction from rel-canonical, as it refers to the representation rather than the content.

rev-canonical

A deprecated way of linking to a short link, briefly popular, disliked and not recommended.

Issues

See Also