From 56b8a88b1f70037b0dab7d85c5cce05c6213176b Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 31 Mar 2012 10:08:16 -0700 Subject: [PATCH] Improve uniqueness of feed entry ID The ID of a feed entry should never change, but the previous method of generating the ID -- i.e., using the entry URL -- results in an ID that is not permanent and can change. Switching to the tag URI method from RFC 4151 should help improve the long-term uniqueness and permanence of entry IDs, as espoused here: Also added a trailing slash to the site URL inside the feed; the lack thereof was causing a feed validation warning. --- pelican/writers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pelican/writers.py b/pelican/writers.py index e72753ab..faca46bd 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -27,7 +27,7 @@ class Writer(object): feed_class = Rss201rev2Feed if feed_type == 'rss' else Atom1Feed feed = feed_class( title=context['SITENAME'], - link=self.site_url, + link=(self.site_url + '/'), feed_url=self.feed_url, description=context.get('SITESUBTITLE', '')) return feed @@ -36,8 +36,9 @@ class Writer(object): feed.add_item( title=item.title, - link='%s/%s' % (self.site_url, item.url), - unique_id='%s/%s' % (self.site_url, item.url), + link='%s%s' % (self.site_url, item.url), + unique_id='tag:%s,%s:%s' % (self.site_url.replace('http://', ''), + item.date.date(), item.url), description=item.content, categories=item.tags if hasattr(item, 'tags') else None, author_name=getattr(item, 'author', 'John Doe'),