Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

FeedLinks

Summary: Add html-header links for auto-discovery of rss/atom feeds
Version: 0.03 (2006-03-19)
Status: Stable
Prerequisites: pmwiki-2.0
Maintainer: Hagan
Discussion: FeedLinks-Talk
Categories: RSS
Votes: 5

Question

How can I add links that will enable autodiscovery of my site's Atom and/or RSS feeds?

Answer

The feedlinks.phpΔ script adds RSS and Atom feed link tags in your pages' HTML Headers. Typical feed links look like this:

<link rel='alternate' title='Your Site : Main - RSS Feed'
    href='http://example.com/wiki/Main/RecentChanges?action=rss'
    type='application/rss+xml' />
<link rel='alternate' title='Your Site : Main - Atom Feed'
    href='http://example.com/wiki/Main/RecentChanges?action=atom'
    type='application/atom+xml' />

Installation

Download feedlinks.phpΔ and place it to your cookbook/ directory, then insert the following line in your local/config.php file:

include_once("$FarmD/cookbook/feedlinks.php");

Settings

By default the script will produce RSS 2.0 and Atom links the site-wide AllRecentChanges page ($SiteGroup/AllRecentChanges). If you want to override the defaults you can pass settings to the script.

For example, to advertise RSS 2.0 feeds by group, use

## Enable the feedlinks recipe, which adds HTML header links that enable
## "autodiscovery" of the site's Atom and/or RSS web feeds.
$EnableSitewideFeed = 0;
$EnableRssLink  = 1;
$EnableAtomLink = 0;
include_once("$FarmD/cookbook/feedlinks.php");  # RSS 2.0 feeds by group

or to advertise RSS and Atom links to a sitewide feed at Main/AllRecentChanges instead of the default $SiteGroup/AllRecentChanges, use

## Enable the feedlinks recipe;  Sitewide RSS 2.0 and Atom Feeds
$FeedLinkSourcePath = 'Main/AllRecentChanges';
include_once("$FarmD/cookbook/feedlinks.php");

Notes

SteP 2009-09-14: I think the code needs changing to support setting feed source and title on a per-group basis. Replace these two lines

  $FeedLinkSourcePath = '$[$Group/RecentChanges]';
  $FeedLinkTitleGroup = ' : $[$Group] -';

with

  SDV($FeedLinkSourcePath, '$[$Group/RecentChanges]');
  SDV($FeedLinkTitleGroup, ' : $[$Group] -');

Releases

  • 2006-01-13: Version 0.01 (Initial release)
  • 2006-01-15: Version 0.02
  • 2006-03-19: Version 0.03 Now can be run multiple times with setting changes in between.

See Also

Contributors

  • Hagan 2006-01-13 Created the recipe on a suggestion by HansB.

Comments

See discussion at FeedLinks-Talk

User notes +2: 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.

Edit - History - Print - Recent Changes - Search
Page last modified on January 05, 2014, at 10:58 AM