Skip to content

Commit 76cf8a0

Browse files
sideshowbarkerinikulin
authored andcommitted
Make <link rel=canonical> a standard rel keyword
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.
1 parent 86a3892 commit 76cf8a0

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

source

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12880,6 +12880,8 @@ interface <dfn>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
1288012880
used are allowed according to the definitions in this specification, then the element does not
1288112881
create any links.</span></p>
1288212882

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

12906+
<p class="note">Theoretically a user agent could support the processing model for the <code
12907+
data-x="rel-canonical">canonical</code> keyword — if it were a search engine that executed
12908+
JavaScript. But in practice that's quite unlikely. So in most cases, <code
12909+
data-x="rel-canonical">canonical</code> ought not be included in <code
12910+
data-x="attr-link-rel">rel</code>'s <span data-x="concept-supported-tokens">supported
12911+
tokens</span>.</p>
12912+
12913+
</div>
12914+
1290412915
<p>A <code>link</code> element must have either a <code data-x="attr-link-rel">rel</code>
1290512916
attribute or an <code data-x="attr-itemprop">itemprop</code> attribute, but not both.</p>
1290612917

@@ -23168,13 +23179,21 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
2316823179
<tbody>
2316923180

2317023181
<tr>
23171-
<td><code data-x="rel-alternate">alternate</code></td> <!-- second most used <link rel> value -->
23182+
<td><code data-x="rel-alternate">alternate</code></td> <!-- fourth most used rel value -->
2317223183
<td><span>Hyperlink</span></td>
2317323184
<td><span>Hyperlink</span></td>
2317423185
<td class="no"> &middot; </td>
2317523186
<td>Gives alternate representations of the current document.</td>
2317623187
</tr>
2317723188

23189+
<tr>
23190+
<td><code data-x="rel-canonical">canonical</code></td> <!-- third most used rel value -->
23191+
<td><span>Hyperlink</span></td>
23192+
<td><em>not allowed</em></td>
23193+
<td class="no"> &middot; </td>
23194+
<td>Gives the preferred URL for the current document.</td>
23195+
</tr>
23196+
2317823197
<tr>
2317923198
<td><code data-x="rel-author">author</code></td>
2318023199
<td><span>Hyperlink</span></td>
@@ -23219,7 +23238,7 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
2321923238
</tr>
2322023239

2322123240
<tr>
23222-
<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 -->
23241+
<td><code data-x="rel-icon">icon</code></td> <!-- second most used rel value -->
2322323242
<td><span data-x="external resource link">External Resource</span></td>
2322423243
<td><em>not allowed</em></td>
2322523244
<td class="no"> &middot; </td>
@@ -23555,6 +23574,17 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
2355523574
</div>
2355623575

2355723576

23577+
<h5>Link type "<dfn><code data-x="rel-canonical">canonical</code></dfn>"</h5>
23578+
23579+
<p>The <code data-x="rel-canonical">canonical</code> keyword may be used with <code>link</code>
23580+
element. This keyword creates a <span>hyperlink</span>.</p>
23581+
23582+
<p>The <code data-x="rel-canonical">canonical</code> keyword indicates that URL given by the <code
23583+
data-x="attr-link-href">href</code> attribute is the preferred URL for the current document. That
23584+
helps search engines reduce duplicate content, as described in more detail in <cite>The Canonical
23585+
Link Relation</cite> specification. <ref spec=RFC6596></p>
23586+
23587+
2355823588
<h5>Link type "<dfn><code data-x="rel-dns-prefetch">dns-prefetch</code></dfn>"</h5>
2355923589

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

119791+
<dt id="refsRFC6596">[RFC6596]</dt>
119792+
<dd><cite><a href="https://tools.ietf.org/html/rfc6596">The Canonical Link Relation</a></cite>, M. Ohye, J. Kupke. IETF.</dd>
119793+
119761119794
<dt id="refsRFC7303">[RFC7303]</dt>
119762119795
<dd><cite><a href="https://tools.ietf.org/html/rfc7303">XML Media Types</a></cite>, H. Thompson, C. Lilley. IETF.</dd>
119763119796

0 commit comments

Comments
 (0)