[drupal-devel] [feature] Patch to add the guid tag to the rss feed

damz drupal-devel at drupal.org
Tue Jul 26 08:22:07 UTC 2005


Issue status update for 
http://drupal.org/node/26223
Post a follow up: 
http://drupal.org/project/comments/add/26223

 Project:      Drupal
 Version:      cvs
 Component:    node system
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  frjo
 Updated by:   damz
 Status:       patch

I 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




damz



Previous comments:
------------------------------------------------------------------------

Sat, 02 Jul 2005 07:29:30 +0000 : frjo

Attachment: http://drupal.org/files/issues/common_rss_guid.patch (537 bytes)

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.

"


------------------------------------------------------------------------

Tue, 19 Jul 2005 06:09:38 +0000 : frjo

Attachment: http://drupal.org/files/issues/common_rss_guid_02.patch (524 bytes)

I made a patch for the cvs version of Drupal also. I believe this is a
smal but very nice improvement of Drupals RSS support.




------------------------------------------------------------------------

Tue, 19 Jul 2005 18:32:06 +0000 : Dries

guid 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.




------------------------------------------------------------------------

Mon, 25 Jul 2005 14:59:30 +0000 : Steven

Possible remedy: generate GUIDs by hashing the base url with the node id
(optionally the word "node" too if we use this technique elsewhere).




------------------------------------------------------------------------

Mon, 25 Jul 2005 19:43:58 +0000 : Dries

Not 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 a guid
to format_rss_item() using the $args parameter.




------------------------------------------------------------------------

Mon, 25 Jul 2005 19:56:59 +0000 : Steven

I 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.




------------------------------------------------------------------------

Mon, 25 Jul 2005 21:32:57 +0000 : damz

An 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




------------------------------------------------------------------------

Tue, 26 Jul 2005 05:22:07 +0000 : frjo

Thanks for your intrest in this issue.


Could you do add a line like this to the node_feed function in
node.module?

<?php
$extra = array_merge($extra, array(array('key' => 'guid', 'value'
=>  $base_url .'/node/'. $node->nid)));
?>


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.







More information about the drupal-devel mailing list