RSSFeedLink

Summary: How to create auto-detect RSS feed links
Version: 2004-12-15
Prerequisites:
Status:
Maintainer: Pm
Categories: RSS

Question

Some sites have RSS feeds that are automatically detected by the browser (such as Firefox's "Live Bookmarks". How can I configure my wiki to do this?

Answer

First, you need to have RSS feeds enabled on your site -- see PmWiki.WebFeeds and Category.RSS. Then, add the following into a local customization file:

    $HTMLHeaderFmt['rss'] = 
      "<link rel='alternate' title='\$WikiTitle RSS'
        href='\$ScriptUrl/\$SiteGroup/[=AllRecentChanges=]?action=rss' 
        type='text/xml' />";
If feed readers have trouble finding the feed (and you have verified its existence/readability via other methods), try type='application/rss+xml' instead. --OtherMichael
Or for the Atom feed, use type='application/atom+xml' Tautrimas

This adds an "alternate" link that some browsers will recognize as a link to subscribe to an RSS feed based on the Site.AllRecentChanges page for your site. (You can of course change this to generate RSS feeds based on any other RecentChanges or WikiTrail page.)

Rewrite rule for changing feeds

Problem: When someone subscribes to your current link and later you change the way how you generate the feed, readers will not adapt to this change.

Solution: Make an alias for RSS link that will be more stable.

If you are hosted on an Apache server, you can make an alias in .htaccess

RewriteRule ^index\.xml$
?action=rss&group=-pmwiki,-site,-main,-contributions,-profiles,-Category&name=-RecentChanges,-Template,-GroupHeader,-GroupFooter
[NC]

and then offer the RSS link as http://[path-to-wiki]/index.xml

Note that everything after ?action=rss should be customized to your requirements, and must match what you have set above. This is, unfortunately, a parallel dependency.

-OtherMichael, thanks to Roman

Notes

See Also

Contributors

  • Pm, 2004-12-15

Feedback

RSS for each Wiki page?

That's exactly what I was looking for ;-) Great!
Where do I have to put this link if I want to provide this RSS file for EACH side, so not only for AllRecentChanges (Therefore AllRecentChanges has to be replaced by some variable???)

ummm, by "each side" above do you really mean each WikiGroup within a site, or...? --Pm
1) I mean a RSS for each site, e.g. for this RSSFeedLink. Whenevery something changes -> show headlines. 2) Another option is, as you said, for each group. So in this site it would be the Cookbook. This option is possibly the more sensible one ;-) Thanks for any help, -- Markus

RSS works best on a page with a WikiTrail and one way to guarantee that is to point to a RecentChanges page.

To point to the current group should be:

   $HTMLHeaderFmt['rss'] = 
      "<link rel='alternate' title='\$WikiTitle RSS'
        href='\$ScriptUrl/\$Group/[=RecentChanges=]?action=rss' 
        type='text/xml' />";

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.