Opened 8 years ago
Last modified 8 years ago
#40587 new enhancement
Feed link markup should contain rel and type attributes
Reported by: | henry.wright | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Feeds | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
The markup of feed links should really contain a rel
and a type
attribute. For example:
<a rel="alternate" type="application/rss+xml" href="https://example.com/feed">#</a>
The post_comments_feed_link()
is an example of where this doesn't happen.
Attachments (3)
Change History (19)
#1
in reply to:
↑ description
;
follow-up:
↓ 13
@
8 years ago
#2
follow-up:
↓ 5
@
8 years ago
Providing a rel attribute will indicate the relationship between the two documents. The type attribute allows us to specify the MIME type and is used as a hint to the user agent (usually the browser).
Also I presume you are actually looking for adding dynamic stuff to them rather than just use static values
Not in this case. The values will be static.
#3
@
8 years ago
I did some digging and as far as I can tell the only 2 functions that output feed link HTML are:
the_feed_link()
post_comments_feed_link()
40587.diff adds both a rel
and type
attribute to each.
#5
in reply to:
↑ 2
@
8 years ago
I like this idea but agree with @subrataemfluence in that it should detect type. I've updated a patch, 40587.2.diff which uses feed_content_type()
instead of hard-coding the content-type.
Mozilla has a good article on implementation for this here:
https://developer.mozilla.org/en-US/docs/Web/RSS/Getting_Started/Syndicating
#7
@
8 years ago
@stevenkword Nice use of feed_content_type()
to account for all feed types. 40587.2.diff is a definite improvement.
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by stevenkword. View the logs.
8 years ago
#13
in reply to:
↑ 1
@
8 years ago
Replying to subrataemfluence:
Out of curiosity:
What additional benefit we would have by adding those two attributes?
Adding "rel" and "type" attributes to anchor tags and link tags facilitate feed auto-discovery. While the "link" tag found in the header is used to advertise the feed related to the rendered page, adding additional links containing these attributes allows the page to advertise additional feeds to search engines.
For example, a home page will contain a "link" element in the "head" that has a one-to-one relationship with main feed. However, an individual post from that same home page could advertise comment feeds for each individual post found on the page if these attributes were leveraged.
In another example, a widget could contain a link to a custom feed that would not otherwise be discovered without a sitemap.
See for more information: https://www.w3.org/TR/html5/links.html#rel-alternate
Out of curiosity:
What additional benefit we would have by adding those two attributes? Also I presume you are actually looking for adding dynamic stuff to them rather than just use static values like "alternate" and "application/rss+xml". If yes, how you want this to work?
Replying to henry.wright: