AmphibiansReptiles
© 2002-2016 |
WebFeedsWeb feeds are a convenient mechanism to let visitors be notified of changes to a site. Instead of repeatedly checking RecentChanges every day to see what is new, a visitor can use a news aggregator to quickly see what pages of interest have changed on a site. Web feeds are commonly recognized by terms such as RSS, Atom, and web syndication. They are also the foundation for podcasting. Based on WikiTrailsIn its simplest form, web feeds in PmWiki are built on WikiTrails. Using a feed action such as Authors can also create custom feeds by simply creating a wiki trail of the pages they want included in the feed. Feeds can also be generated from groups, categories, and backlinks, and the order and number of items in the feed can be changed using options in the feed url. Thus, one can obtain a feed for the Skins category (sorted with most recent items first) by using PmWiki is able to generate feeds in many formats, including RSS 2.0 ( How to read a PmWiki syndicated feed
Feed optionsAdd any of the following options to the end of a PmWiki web feed url to change its output (basically any pagelist option is available for web feeds):
authors (intermediate) Configure PmWiki for feedsThis section describes how to syndicate portions of a wiki to appear in a web feed. It does not describe how to display a web feed within a wiki page -- for that, see Cookbook:RssFeedDisplay. To enable web feed generation for a site, add one or more of the following to a local customization file: if ($action == 'rss') include_once("$FarmD/scripts/feeds.php"); if ($action == 'atom') include_once("$FarmD/scripts/feeds.php"); if ($action == 'rdf') include_once("$FarmD/scripts/feeds.php"); if ($action == 'dc') include_once("$FarmD/scripts/feeds.php"); or you can combine multiple feeds into a single expression using "||" to separate each feed type. For example, if you want to enable RSS and Atom feeds you would use if ($action == 'rss' || $action == 'atom' || $action == 'rdf' || $action == 'dc') include_once("$FarmD/scripts/feeds.php"); Configure feed contentWeb feeds are highly configurable, new elements can be easily added to feeds via the $FeedFmt array. Elements in $FeedFmt look like
where the first index corresponds to the action (?action=atom), the second index indicates a per-feed or per-item element, and the third index is the name of the element being generated. The above setting would therefore generate a "<rights>All Rights Reserved</rights>" in the feed for ?action=atom. If the value of an entry begins with a '<', then feeds.php doesn't automatically add the tag around it. Elements can also be callable functions which are called to generate the appropriate output. See RSS specification or other feed specifications for what feed content you can use. You can also change an existing element rather than add a new one. You can use the following lines to ensure that changes made to the wiki will be picked up by some RSS readers that wouldn't otherwise "notice" a page has been changed: # Change the link URL when an item is edited. $FeedFmt['rss']['item']['link'] = '{$PageUrl}?when=$ItemISOTime'; $FeedFmt['atom']['item']['link'] = "<link rel=\"alternate\" href=\"{\$PageUrl}?when=\$ItemISOTime\" />\n"; See Also
FAQHow do I include text from the page (whole page, or first X characters) in the feed body? (note: markup NOT digested) function MarkupExcerpt( Does this mean if I want to include the time in the rss title and "summary" to rss body I call $FeedFmt['rss']['item']['description'] = '$LastSummary'; $FeedFmt['rss']['item']['title'] = '{$Group} / {$Title} @ $ItemISOTime';
How can I use the RSS <enclosure> tag for podcasting? For podcasting of mp3 files, simply attach an mp3 file to the page with the same name as the page (i.e., for a page named Podcast.Episode4, one would attach to that page a file named "Episode4.mp3"). The file is automatically picked up by ?action=rss and used as an enclosure. The set of potential enclosures is given by the $RSSEnclosureFmt array, thus $RSSEnclosureFmt = array('{$Name}.mp3', '{$Name}.wma', '{$Name}.ogg');
allows podcasting in mp3, wma, and ogg formats. How to add "summary" to the title in a rss feed (ie. with Add this line in you $FeedFmt['rss']['item']['title'] = '{$Group} / {$Title} : $LastModifiedSummary';
How to add "description" to the title in an rss feed, and summary to the body? Add these lines to your $FeedFmt['rss']['item']['title'] = '{$Group} / {$Title} : {$Description}';
$FeedFmt['rss']['item']['description'] = '$LastModifiedSummary';
NOTES:
Some of my password-protected pages aren't appearing in the feed... how do I work around this? From a similar question on the newsgroup, Pm's reply: The last time I checked, RSS and other syndication protocols didn't really have a well-established interface or mechanism for performing access control (i.e., authentication). As far as I know this is still the case. PmWiki's WebFeeds capability is built on top of pagelists, so it
could simply be that the The "downside" to setting You could also set if ($action == 'rss') This limits the ability to see the protected pages to RSS feeds; normal pagelists and searches wouldn't see them. Lastly, it's also possible to configure the webfeeds to obtain the authentication information from the url directly, as in: .../Site/AllRecentChanges?action=rss&authpw=secret The big downside to this is that the cleartext password will end up traveling across the net with every RSS request, and may end up being recorded in Apache's access logs. How to add feed image? Add the following to local/config.php (this example is for $FeedFmt['rss']['feed']['image'] = " <title>Logo title</title> <link>http://example.com/</link> <url>http://example.com/images/logo.gif</url> <width>120</width> <height>60</height>"; Do not forget NOT to start with a '<' as there would be no <image> tag around this... See here.
How do I insert RSS news feeds into PmWiki pages? How can I specify default feed options in a configuration file instead of always placing them in the url? For example, if you want if ($action == 'rss') SDVA($_REQUEST, array( 'group' => 'News', 'order' => '-time', 'count' => 10)); Are there ways to let people easily subscribe to a feed? On some browsers (Mozilla Firefox), the visitor can see an orange RSS icon in the address bar, and subscribe to the feed by clicking on it. To enable the RSS icon, add this to config.php : $HTMLHeaderFmt['feedlinks'] = '<link rel="alternate" type="application/rss+xml" title="$WikiTitle" href="$ScriptUrl?n=Site.AllRecentChanges&action=rss" /> <link rel="alternate" type="application/atom+xml" title="$WikiTitle" href="$ScriptUrl?n=Site.AllRecentChanges&action=atom" />'; You can also add such a link, for example in your SideBar, Can I create an RSS feed for individual page histories? See Cookbook:PageFeed. How do I create a custom FeedPage similar to RecentChanges or AllRecentChanges, but with only certain groups or pages recorded? See Cookbook:CustomRecentChanges. In a nutshell, you'll declare a if (PageVar($pagename, '$Group')!='ForbiddenGroup') { $RecentChangesFmt['Site.MyFeedPage'] = '* [[{$FullName}]] . . . $CurrentTime $[by] $AuthorLink: [=$ChangeSummary=]'; } How can I update my RSS feed to show every edit for pages on that feed, not just new pages added to the feed? Add unique guid links for each edit to your to config.php file (see PITS entry): $FeedFmt['rss']['item']['guid'] = '{$PageUrl}?guid=$ItemISOTime'; Alternatively, you can create the option for edit monitoring by adding a qualifier for RSS links. This allows the user to choose between default new pages RSS feeds and new edits RSS feeds (pmwiki.org has this option enabled). ## For new pages updates: http://example.com/wiki/HomePage?action=rss ## For edits updates: http://example.com/wiki/HomePage?action=rss&edits=1 if(@$_REQUEST['edits'] && $action == 'rss') $FeedFmt['rss']['item']['guid'] = '{$PageUrl}?guid=$ItemISOTime'; This page may have a more recent version on pmwiki.org: PmWiki:WebFeeds, and a talk page: PmWiki:WebFeeds-Talk. |