How To Tell Web Browsers About Atom Feeds

2020-06-08 15:39发布

问题:

My website has an Atom feed and I want to make it easier to subscribe to it. I see that many sites such as StackOverflow have the Atom icon in the location bar in Firefox 3. I haven't, however, been able to work out how.

I assume some HTML is needed - but what tags specify the the browser that a page has a feed?

回答1:

While the code provided in (all!) the other answers is absolutely correct, I would recommend against giving your feed a title of "RSS" if the format used is actually Atom. RSS, of course, refers to an entirely separate format for feeds and syndication and there's enough confusion among the general population about what the differences are that I wouldn't suggest feeding the fire. :-)

Instead, give your feed a more descriptive title (such as "News feed", "Blog feed", "Comics", etc.) based on your content. Also, it is absolutely possible for you to include multiple feed links in the same page, if you have more than one type of content!

<link rel="alternate" type="application/atom+xml" title="News" href="/atom.xml?type=news" />
<link rel="alternate" type="application/atom+xml" title="Blog" href="/atom.xml?type=blog" />
<link rel="alternate" type="application/atom+xml" title="Comics" href="/atom.xml?type=comics" />