This patch add the guid (globally unique identifier) tag to the rss feed. This is in line with the RSS 2.0 Specification, se below. It's a very simpel, one line patch, to the format_rss_item function in common.inc.
I want this personally so my news reader (NetNewsWire) can distinguish between new and updates posts.
From http://blogs.law.harvard.edu/tech/rss
A frequently asked question about s is how do they compare to
s. Aren't they the same thing? Yes, in some content systems, and no in others. In some systems,
is a permalink to a weblog item. However, in other systems, each is a synopsis of a longer article,
points to the article, and is the permalink to the weblog entry. In all cases, it's recommended that you provide the guid, and if possible make it a permalink. This enables aggregators to not repeat items, even if there have been editing changes.
Comment | File | Size | Author |
---|---|---|---|
#1 | common_rss_guid_02.patch | 524 bytes | frjo |
common_rss_guid.patch | 537 bytes | frjo | |
Comments
Comment #1
frjo CreditAttribution: frjo commentedI made a patch for the cvs version of Drupal also. I believe this is a smal but very nice improvement of Drupals RSS support.
Comment #2
Dries CreditAttribution: Dries commentedguid has to be permanent. I don't think we can guarantuee that at the moment. People can set URL aliases and stuff, and these changes would change the guid.
Comment #3
Steven CreditAttribution: Steven commentedPossible remedy: generate GUIDs by hashing the base url with the node id (optionally the word "node" too if we use this technique elsewhere).
Comment #4
Dries CreditAttribution: Dries commentedNot quite. The problem is that
$link
is not necessarily unique (subject to change) as it can be aliased.foo.com/node/1
(non-aliased URL) is as unique as its hashed variant, and should be fairly unique (unless your are playing$base_url
tricks). I think the solution is to pass aguid
toformat_rss_item()
using the$args
parameter.Comment #5
Steven CreditAttribution: Steven commentedI only meant those things: base URL, node ID and the word "node". Regardless of where it comes from. Perhaps we need a generic GUID generating mechanism. I chose the base URL as a unique "permanent" site-specific seed with the understanding that if your base URL changes, your feed location changes too and aggregators need to refresh anyway.
Comment #6
Damien Tournoud CreditAttribution: Damien Tournoud commentedAn open question: in the RSS feed, should the urls be aliased ones or "base" (
/node/#nid
) ones?I do think base ones are better, because they are permanent and reliable. RSS is meant for automated processes. URL aliases are meant for humans.
-- DamZ
Comment #7
frjo CreditAttribution: frjo commentedThanks for your intrest in this issue.
Could you do add a line like this to the node_feed function in node.module?
Just below the line where pubDate is added in the same manner.
This seems more complicated than adding a $guid argument to the format_rss_item function in common.inc but maybe it's a bad idé to go around changing functions that other modules can be using.
Comment #8
Damien Tournoud CreditAttribution: Damien Tournoud commentedI like the idea of building the guid from the
$link
. But for this to be consistant and permanent, we should use the "normal" node link, not the aliased one. So we must give an answer to my primary question.-- DamZ
Comment #9
frjo CreditAttribution: frjo commentedI believe the link tag should stay as it is, i.e. a standard Drupal URL with path alias if one is set.
The guid tag on the other hand need to be different as Dries stated, it must be a permanent URL. A URL with the format "base_url/node/nid" should do the job.
The code sample from my last comment can handle this I hope.
Comment #10
kika CreditAttribution: kika commentedatom.module also needs a GUID so it is probably worth to introduce a genereric function
More background reading:
http://diveintomark.org/archives/2004/05/28/howto-atom-id
http://atompub.org/2005/07/11/draft-ietf-atompub-format-10.html#rfc.sect...
btw, 'created' timestamp also adds extra uniqueness
Comment #11
Gábor HojtsyDrupal 4.7 and up has this feature. Look at http://drupal.org/rss.xml to see. It has
<guid isPermaLink="false">77562 at http://drupal.org</guid>
type guids.Comment #12
(not verified) CreditAttribution: commented