Skip to content

Commit

Permalink
Make <link rel=canonical> a standard rel keyword
Browse files Browse the repository at this point in the history
This change adds “canonical” to the HTML spec as a standard keyword
allowed in the value of the rel="" attribute for the <link> element.

Fixes whatwg#2351.
  • Loading branch information
sideshowbarker authored and domenic committed Apr 12, 2017
1 parent 9d3022d commit 6dc0004
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -12880,6 +12880,8 @@ interface <dfn>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
used are allowed according to the definitions in this specification, then the element does not
create any links.</span></p>

<div w-nodev>

<p><code data-x="attr-link-rel">rel</code>'s
<span data-x="concept-supported-tokens">supported tokens</span> are the keywords defined in
<a href="#linkTypes">HTML link types</a> which are allowed on <code>link</code> elements, impact
Expand All @@ -12901,6 +12903,15 @@ interface <dfn>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
tokens</span> must only include the tokens from this list that the user agent implements the
processing model for.</p>

<p class="note">Theoretically a user agent could support the processing model for the <code
data-x="rel-canonical">canonical</code> keyword — if it were a search engine that executed
JavaScript. But in practice that's quite unlikely. So in most cases, <code
data-x="rel-canonical">canonical</code> ought not be included in <code
data-x="attr-link-rel">rel</code>'s <span data-x="concept-supported-tokens">supported
tokens</span>.</p>

</div>

<p>A <code>link</code> element must have either a <code data-x="attr-link-rel">rel</code>
attribute or an <code data-x="attr-itemprop">itemprop</code> attribute, but not both.</p>

Expand Down Expand Up @@ -23168,13 +23179,21 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
<tbody>

<tr>
<td><code data-x="rel-alternate">alternate</code></td> <!-- second most used <link rel> value -->
<td><code data-x="rel-alternate">alternate</code></td> <!-- fourth most used rel value -->
<td><span>Hyperlink</span></td>
<td><span>Hyperlink</span></td>
<td class="no"> &middot; </td>
<td>Gives alternate representations of the current document.</td>
</tr>

<tr>
<td><code data-x="rel-canonical">canonical</code></td> <!-- third most used rel value -->
<td><span>Hyperlink</span></td>
<td><em>not allowed</em></td>
<td class="no"> &middot; </td>
<td>Gives the preferred URL for the current document.</td>
</tr>

<tr>
<td><code data-x="rel-author">author</code></td>
<td><span>Hyperlink</span></td>
Expand Down Expand Up @@ -23219,7 +23238,7 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
</tr>

<tr>
<td><code data-x="rel-icon">icon</code></td> <!-- link rel="shortcut icon" and its ilk are the fourth, sixth, and ninth most used values -->
<td><code data-x="rel-icon">icon</code></td> <!-- second most used rel value -->
<td><span data-x="external resource link">External Resource</span></td>
<td><em>not allowed</em></td>
<td class="no"> &middot; </td>
Expand Down Expand Up @@ -23555,6 +23574,17 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
</div>


<h5>Link type "<dfn><code data-x="rel-canonical">canonical</code></dfn>"</h5>

<p>The <code data-x="rel-canonical">canonical</code> keyword may be used with <code>link</code>
element. This keyword creates a <span>hyperlink</span>.</p>

<p>The <code data-x="rel-canonical">canonical</code> keyword indicates that URL given by the <code
data-x="attr-link-href">href</code> attribute is the preferred URL for the current document. That
helps search engines reduce duplicate content, as described in more detail in <cite>The Canonical
Link Relation</cite> specification. <ref spec=RFC6596></p>


<h5>Link type "<dfn><code data-x="rel-dns-prefetch">dns-prefetch</code></dfn>"</h5>

<p>The <code data-x="rel-dns-prefetch">dns-prefetch</code> keyword may be used with
Expand Down Expand Up @@ -119630,6 +119660,9 @@ INSERT INTERFACES HERE
<dt id="refsRFC6350">[RFC6350]</dt>
<dd><cite><a href="https://tools.ietf.org/html/rfc6350">vCard Format Specification</a></cite>, S. Perreault. IETF.</dd>

<dt id="refsRFC6596">[RFC6596]</dt>
<dd><cite><a href="https://tools.ietf.org/html/rfc6596">The Canonical Link Relation</a></cite>, M. Ohye, J. Kupke. IETF.</dd>

<dt id="refsRFC7303">[RFC7303]</dt>
<dd><cite><a href="https://tools.ietf.org/html/rfc7303">XML Media Types</a></cite>, H. Thompson, C. Lilley. IETF.</dd>

Expand Down

0 comments on commit 6dc0004

Please sign in to comment.