Reputation: 15892
Using the category tag in RSS 2.0:
<category domain="http://mysite.example.com/tags">
Science and Technology
</category>
How would I provide an additional URL to the page that shows all of the items in that category?
Since the spec doesn't appear cover this, would it be safe to invent a new attribute in my own namespace, like this:
<category domain="http://mysite.example.com/tags"
myns:category-url="http://mysite.example.com/tags/scitech/">
Science and Technology
</category>
Then at the top of the document:
<rss version="2.0" xmlns:myns="http://mysite.example.com/namespace/">
Is it OK to extend RSS in this way? Are any aggregators or implementations out there in the wild likely to break? Or is there an existing mechanism for linking to a category page that I should be using instead?
I'm interested in seeing how this would be done in Atom as well, but I need a solution for RSS 2.0.
Upvotes: 4
Views: 805
Reputation: 15892
http://validator.w3.org/feed/docs/warning/UseOfExtensionAttr.html
The RSS 2.0 spec is unclear as to whether you can add your own namespaced attributes to existing RSS elements. The RSS Advisory Board ruled that you can, but RSS politics meant their recommendations were never added to the official spec.
I'm still not sure what the best way of specifying "this category has this URL on the web" is, in RSS or Atom.
Upvotes: 0
Reputation: 2846
As you notice in the comment, it just says "A RSS feed may contain elements not described on this page, only if those elements are defined in a namespace.", but says nothing about new attributes, so I'd think that it is at least against the spirit of the spec to do so.
My understanding is that whatever is described in that page ought be considered frozen, with the exception of the ability to add namespaced elements.
Thus, i think that the one way to add what you need is to add a new element which has to have a content matching a category and an attribute holding the URL to the page that shows all of the items in that category:
<rss version="2.0" xmlns:myns="http://mysite.example.com/namespace/">
<category domain="http://mysite.example.com/tags">
Science and Technology
</category>
<myns:category-url url="http://mysite.example.com/tags/scitech/">
Science and Technology
</myns:category-url>
It's not pretty but it may work
Upvotes: 1
Reputation:
Yes, it should be perfectly safe to extend with a namespace - that is, after all, written explicitly in the spec at http://cyber.law.harvard.edu/rss/rss.html#extendingRss
Upvotes: 1