Comments (3)
http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#rel-alternate
The alternate keyword may be used with link, a, and area elements. The meaning of this keyword depends on the values of the other attributes. ... The alternate keyword is used with the type attribute set to the value application/rss+xml or the value application/atom+xml
And the example provided:
<link rel="alternate" type="application/atom+xml" href="data.xml">
From this documentation, where do you read the type
on rel="alternate"
as optional?
In DiveIntoHTML5, the context is:
This link relation is also quite common. <link rel="alternate">, combined with either the RSS or Atom media type in the type attribute, enables something called “feed autodiscovery.” ... Unlike with rel="stylesheet", the type attribute matters here. Don’t drop it!
from diveintohtml5.
Hi Jonathan; thanks for the reply and for your work on this resource.
I found the DiveIntoHTML5 line confusing and it could use some clarification. From section 4.12.2 on whatwg.org link above:
The type attribute, _if present, gives the MIME type of the linked resource. It is purely advisory. The value must be a valid MIME type. User agents must not consider the type attribute authoritative — upon fetching the resource, user agents must not use metadata included in the link to the resource to determine its type._
So that is where I got that type is optional. In fact, devices are instructed NOT to use it verbatim. The whatwg blog:
http://blog.whatwg.org/feed-autodiscovery
also confirms that type is optional:
It also means that you do not need to specify the type attribute to have the link recognised as a syndication feed and browsers can still show it in the subscription list.
However, the type is required if you want to set one of your links as the DEFAULT feed for that page. The whatwg.org page, section 4.12.5.1 explains:
The first link, a, or area element in the document (in tree order) with the alternate keyword used with the type attribute set to the value application/rss+xml or the value application/atom+xml must be treated as the default syndication feed for the purposes of feed autodiscovery.
IOW, you could have three rel="alternate" links on your page, but set the second one as the default feed by specifying its type and not setting a type for the first link:
<link rel="alternate" href="data1.xml">
<link rel="alternate" type="application/atom+xml" href="data2.xml">
<link rel="alternate" type="application/atom+xml" href="data3.xml">
All three links will be discovered as feeds, thanks to feed autodiscovery, but the second link is the first one to meet the requirements to be considered the default feed for that page.
I would propose replacing the paragraph with the following:
This link relation is also quite common. enables something called “feed autodiscovery.” It allows syndicated feed readers (like Google Reader) to discover that a site has a news feed of the latest articles. Some browsers also support feed autodiscovery by displaying a special icon next to the URL.
A type is not required (and, in fact, is ignored by the reader). However, if you have multiple rel="alternate" links on your page and want to specify which one should be considered the default for that page, simply add a type (type="application/atom+xml" or type="application/rss+xml") to that link and remove it from the others. The first link found (in tree order) that specifies a type will be considered the default feed for that page.
Thanks again!
from diveintohtml5.
I understand your points, and you're right in a computer way. Indeed, "type" is optional, but like many optional features, if you want the desired effect, then using it is required. Also, the additions needed to illustrate such a minute detail would take away from the easy, breezy, beautiful style of the chapter.
If you're not satisfied with my reasoning, I am absolutely open to you commenting again or reopening the issue.
from diveintohtml5.
Related Issues (20)
- hgroup is no longer part of the spec HOT 1
- Diving Out of Dogs
- Incorrect external quote in charset meta HOT 6
- I got two suggestions (svg, hgroup) HOT 1
- Generic Headers using hgroup deprecated HOT 3
- geolocation.html geoSuccess/geoError vs geo_success/geo_error HOT 2
- Broken link
- Halma implementation broken? HOT 1
- old link broken HOT 2
- Broken link @ storage HOT 1
- Domain name DIVEINTOHTML5.INFO expired HOT 4
- broken link @ detect
- outdated section @ detect
- Comparing with null object HOT 2
- http://diveintohtml5.info/ HOT 1
- Website looks broken HOT 3
- Does it still accept pull requests?
- Missing "to"?
- Please provide an HTTPS website link HOT 6
- HTTPS TLS certificate expired
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diveintohtml5.