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
Comment #1
Grayside commentedIn 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.
Comment #2
Grayside commentedAttached patch is similar to the above code, but more efficient and conditional as I described in #1.
Comment #3
Grayside commentedHandling whitespace a little better.
Comment #4
maciej.zgadzaj commentedThis behavior has been changed in 2.x branches of the module.
isPermaLinkattribute 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.