01161: Add guid tag to each item of RSS feeds

Summary: Add guid tag to each item of RSS feeds
Created: 2010-01-02 10:10
Status: Closed - documentation updated
Category: CoreCandidate
From: Diafygi
Assigned:
Priority: 44
Version: 2.2.8
OS: All/All/All

Description: For many RSS readers/aggregators, new items are identified by new <guid> tags in the <item> element. Guid is a unique identifier for that item.

Currently, PmWiki doesn't include guid tags in it's RSS feeds. Consequently, many RSS readers don't recognize when a change has been made to an item.

This patch adds the guid tag to the feeds.php script. Each unique id contains the last update time of the page, {$PageUrl}?guid=$ItemUnixTime (i.e. http://example.com/Main/Home/?guid=1234567890) EDIT: patch uses $ItemUnixTime now. EDIT 2010-01-25: This patch adds an option to force a guid tag. Just add an ?edits=1 option to the url for the feed. For example, http://www.example.com/wiki/Main/Page?action=rss&edits=1 will contain guid tags.

PATCH: New feeds.php file: feeds_with_guid.php EDIT: updated to include ?edits=1 url option
Diff between old and new files: feeds_with_guid.diff EDIT: updated to include ?edits=1 url option


I'm not sure that adding the timestamp to the link should be the default. It's certainly easily done as a local customization. I'm not inflexible on this point, though -- I'd bend to the will of the majority here. I just know there are likely sites that

  • don't* want every edit to result in a new unique identifier

for a page, and since it's a 1-line local customization in config.php, it's not terribly onerous to keep it that way.

It might deserve a line in docs/sample-config.php, however.

Also, there's no need to create a separate page variable for the timestamp -- unix timestamps are already available as $LastModifiedTime. Personally, I'd much prefer to see an ISO-formatted dated as the timestamp rather than a unix timestamp. Thus the local modification for this is simply:

    $FeedFmt['rss']['item']['guid'] = '{$PageUrl}?guid=$ItemISOTime';

or

    $FeedFmt['rss']['item']['guid'] = '{$PageUrl}?guid=$LastModifiedTime';

 > I say we have the <link> element contain {$PageUrl} (like it does now)
 > and add a separate <guid> element that adds on a unique identifier by
 > default. I'm ok with the uid being ISO instead of Unix, but we really
 > need unique links for RSS feeds.

We do have unique links for RSS feeds -- each page url serves as its own guid (by virtue of there not being a guid entry by default).

The question I'm posing is whether each separate edit to a page should default to generating a new guid for the page. I think that should be a per-site decision, not something that PmWiki dictates to be the case.

On the other hand, if the vast majority of sites expect that every edit should result in a new entry in an aggregator, then I'm willing to change the default, as long as we make it clear how to get back to the other behavior.

Pm


Relevant mailing list thread.

I guess it depends on what the purpose of your wiki is. For collaborative-style wiki's (like pmwiki.org), monitoring edits is needed. If you're running a blog-style site, just new pages added to the WikiTrail used for RSS generation is needed.

So, the current default for RSS is geared toward more of a blog-style website. I'd like to switch the default to wiki-like edit monitoring (we are a wiki, after all), but I don't know what the majority of PmWiki admins do with their sites.

Edit monitoring includes new entry monitoring, but the opposite is not true. New entry monitoring skips over edits to old pages. I'd rather have extra updates than miss some by default.

Classic example: I have a wikitrail on my profile page, and I subscribe to the RSS feed for it. This PITS bug is in that trail, but my aggregator didn't list Petko's Pm update to the page (because there was no unique link). The whole reason wiki's have that RSS feeds is to monitor updates to wiki pages, and PmWiki fails in this regard.

I've updated the proposed edit to feeds.php to use $ItemISOTime instead of a new variable.
-Diafygi, 2010/01/05


Updated patch to allow both traditional and guid behaviors. If the feed url contains an ?edits=1 option, a <guid> tag will be included with the each feed item.
-Diafygi, 2010/01/25