The guid field in RSS by default is a permanent URL to the content. However, I would like to be able to use strings other than URLs as the guid, which means including the isPermaLink="false" attribute. Would it be possible to toggle this attribute for guid? For now I'm using the following hack, which is no good for those who want the guid to be a permalink ...

--- views_rss_views_fields.theme.inc.orig	2009-09-28 02:33:15.000000000 -0700
+++ views_rss_views_fields.theme.inc	2009-09-28 02:31:27.000000000 -0700
@@ -51,7 +53,7 @@
   // Loop through key=>value pairs
   foreach ($item as $key => $value) {
     if ($value) {
-      $row .= '<' . $key . '>' . filter_xss_admin($value) . '</' . $key . '>
+      $row .= '<' . $key . ($key == 'guid'? ' isPermaLink="false"': '') . '>' . filter_xss_admin($value) . '</' . $key . '>
       ';
     }
   }

Comments

Grayside’s picture

Version: 6.x-1.0-beta1 » 6.x-1.x-dev

In fact, it appears that without setting <guid isPermaLink="false"> the RSS path property will not be used by some RSS Readers, as the GUID is the master URL by the spec if it is not set explicitly false.

It seems to me that this property should be set if the link "Field usage" configuration is not null.

Grayside’s picture

Status: Active » Needs review
StatusFileSize
new1.07 KB

Attached patch is similar to the above code, but more efficient and conditional as I described in #1.

Grayside’s picture

StatusFileSize
new1.07 KB

Handling whitespace a little better.

maciej.zgadzaj’s picture

Status: Needs review » Closed (fixed)

This behavior has been changed in 2.x branches of the module.

isPermaLink attribute is now automatically added to <guid> element, with its value set to:

  • false - if value for <link> element was provided,
  • true - if no value for <link> element was provided and <guid> value is a valid URL.