By remtheory on
Hi there,
I'm building a site with a ton of RSS feeds. They all work great except for one nagging problem (and it only seems to be in Google Reader so far). When I subscribe to the feed, the name of the feed is "title unknown" (node titles are fine, it's just the feed title that isn't getting pulled in). Every feed has a title, though. I've googled the heck out of this problem, but no luck. I'm beginning to think Google's blocking the answer. ;)
Can someone help me figure this out?
Thanks!
Rachel
Comments
Sample feed
Can you provide a sample feed URL?
Also: have you tried it in other feed readers?
Thanks.
http://CrookedNumber.com
Maybe anonymous users is the problem?
The site's currently in development, so I've hidden access to anonymous users. But I just created a fake test account so you can see the feeds. It seems to work fine in IE's browser/reader system. So weird. I hate it when things seem to "work better" in Microsoft.
http://dev.facinghistory.org/taxonomy/term/1/0/feed
You can log in as:
user: tester
pword: test
I think you're probably right
If the feed has restricted access, that'll definitely cause problems for readers trying to consume the feed via a reader. (Though, if logged in, they can view it in a browser, as RSS.) Both Google Reader and Bloglines had issues (BL couldn't even detect a feed). Similarly, remote attempts to validate the feed failed.
The good news is that I pasted the RSS into a validator and it passed.
Are you ultimately going to allow anonymous access to the feeds? If so, I'm not sure I'd worry about it. (Though I'd definitely double-check them before launch; i.e., allow anonymous access for a brief time, to test feeds in readers.)
If you are, you should know that password-protected feeds are pretty tricky.
http://CrookedNumber.com
Thank you!
Thanks so much for looking into this. Yes, they'll be open to the public soon. I'll definitely take your advice and open the site up to make sure it works. I didn't even think to check it through a validator. Very helpful advice.
Resolved the same issue...
Rachel,
I recently ran into the same issue, and it didn't turn out to be an issue of access to my view.
I had to edit the theme_views_rss_feed function to add Atom to the namespace...that is the only edit I made and the title started to appear for me in Google Reader.
I have pasted the code below and highlighted the change I made from the Drupal 5 version of the function.
function theme_views_rss_feed($view, $nodes, $type) {
if ($type == 'block') {
return;
}
global $base_url;
$channel = array(
// a check_plain isn't required on these because format_rss_channel
// already does this.
'title' => views_get_title($view, 'page'),
'link' => url($view->feed_url ? $view->feed_url : $view->real_url, NULL, NULL, true),
'description' => $view->description,
);
$item_length = variable_get('feed_item_length', 'teaser');
$namespaces = array('xmlns:dc="http://purl.org/dc/elements/1.1/"', 'xmlns:atom="http://www.w3.org/2005/Atom"');
// Except for the original being a while and this being a foreach, this is
// completely cut & pasted from node.module.
foreach ($nodes as $node) {
// Load the specified node:
$item = node_load($node->nid);
$link = url("node/$node->nid", NULL, NULL, 1);
if ($item_length != 'title') {
$teaser = ($item_length == 'teaser') ? TRUE : FALSE;
// Filter and prepare node teaser
if (node_hook($item, 'view')) {
node_invoke($item, 'view', $teaser, FALSE);
}
else {
$item = node_prepare($item, $teaser);
}
// Allow modules to change $node->teaser before viewing.
node_invoke_nodeapi($item, 'view', $teaser, FALSE);
}
// Allow modules to add additional item fields
$extra = node_invoke_nodeapi($item, 'rss item');
$extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => date('r', $item->created)), array('key' => 'dc:creator', 'value' => $item->name), array('key' => 'guid', 'value' => $item->nid . ' at ' . $base_url, 'attributes' => array('isPermaLink' => 'false'))));
foreach ($extra as $element) {
if ($element['namespace']) {
$namespaces = array_merge($namespaces, $element['namespace']);
}
}
// Prepare the item description
switch ($item_length) {
case 'fulltext':
$item_text = $item->body;
break;
case 'teaser':
$item_text = $item->teaser;
if ($item->readmore) {
$item_text .= '
'. l(t('read more'), 'node/'. $item->nid, NULL, NULL, NULL, TRUE) .'
';
}
break;
case 'title':
$item_text = '';
break;
}
$items .= format_rss_item($item->title, $link, $item_text, $extra);
}
$channel_defaults = array(
'version' => '2.0',
'title' => variable_get('site_name', 'drupal') .' - '. variable_get('site_slogan', ''),
'link' => $base_url,
'description' => variable_get('site_mission', ''),
'language' => $GLOBALS['locale'],
);
$channel = array_merge($channel_defaults, $channel);
$output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$output .= "\n";
$output .= format_rss_channel($channel['title'], $channel['link'], $channel['description'], $items, $channel['language']);
$output .= "\n";
drupal_set_header('Content-Type: text/xml; charset=utf-8');
print $output;
module_invoke_all('exit');
exit;
}
Good luck, hope that works out for you.
Micah
Where is theme_views_rss_feed function located?
I realize it's probably a very dumb question, but any help is appreciated. :-)
Thanks,
Carol
same problem here
I'm having the same trouble using Drupal 6. I've searched for the theme_views_rss_feed function but can't find it.
My site and RSS feed are public.
Can anyone help please?
Thanks,
Vonn
Views title
If you driving your rss feeds from view make sure you have given the view a title.
Regards,
Sumaiya Javed
Web Developer
www.sumaiyajaved.com
www.phpjavascript.com
One more thing to check
Also, make sure to unsubscribe from the RSS feed with "Title Unknown", make the changes to the View, and then re-subscribe to the updated RSS feed. This made the difference for me. Google Reader didn't recognize the refreshed RSS feed until I unsubscribed from the old one.
Use the site name
Try selecting "Title" for the feed in Views, and check the option "Use the site name for the title."
This was the only way I could find to get a title for the feed in Google Reader, without coding anything. Worked in Drupal 6.12 with views-6.x-2.5.
Kieran
For Me This Didn't Fix it - the XML change above did
I have no doubt that the varioius "solutions" listed here worked for the posters. Considering that this problem has been solved in a variety of ways, I'm thinking that the problem is buggy themes.
I had the same problem.
1. It wasn't an issue of permissions as everything was public.
2. I tried the above suggestion (one of the easiest proposed solutions) and using the site name for the title did not give me a better result. Neither did defining my own title.
I'm using Drupal 6.13 and Views 6.x-2.5.
Before rusing into a code change, I saved the XML file (had to open it in Lynx since every time I tried to open it in Firefox, it wanted to go straight to Google Reader and wouldn't allow me to view the XML.
Then I manually made the change highlighted by mtopping
The result made the first line of the XML file look like
<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="http://www.mysite.com/rss/feed.xml" xmlns:dc="http://purl.org/dc/elements/1.1/, xmlns:atom='http://www.w3.org/2005/Atom">Update: Not sure what is happening here but the code I pasted is not showing up. I'm sure that there is a way of formatting the code. Hopefully enclosing it
tags as I've now done will fix it. If not, it might not show up as I expected but I essentially just created the XML file in a way that it would have been created after being parsed by the PHP code above.I saved the file with a different name than my Feed defined in Views, uploaded it to the web server, and loaded the URL into Google Reader.
It worked.
I apparently need to change the code in the above listed function. I don't know where to find this but considering that no one has posted that information in over a year, I'm probably not going to find it here. The one thing I know is that this needs to be changed on the theme level if possible because otherwise, my changes will be reversed the next time I do a security update to a new version of Drupal. This is tshe kind of thing I (everyone else who faces this) doesn't want to have to keep going back and fixing everytime there is an upgrade.
I'll try to make sure I come back and post an update when I get this figured out that has better information on how to edit that function.
Temporary Fix
Fixed it a little faster than I thought.
I searched all of the files in my drupal directory for
http://purl.org/dc/elements/1.1/which is the first part of the line that needs to be changed.It was found in three files.
modules/node.module
sites/all/modules/views/modules/aggregator/views_plugin_row_aggregator_rss.inc
sites/all/modules/views/modules/comment/views_plugin_row_comment_rss.inc
sites/all/modules/views/modules/node/views_plugin_row_node_rss.inc
The files were a little different from what was listed above (probably a different version of something).
In each case, the relevant information was an element of an array. It started out as
'namespace' => array('xmlns:dc' => 'http://purl.org/dc/elements/1.1/'),and I changed it in each instance to
I started just editing the sites/all/modules/views/modules/node/views_plugin_row_node_rss.inc and that didn't solve the problem. I then edited both of the other two at the same time. I think it was probably the aggregator file that did it. But I figured it might make sense to change them all anyway.
Note: These lines were found in a function render($row)
If you don't know already, DO NOT edit the node.module file. This is a core Drupal file and you'll lose your changes if you ever upgrade Drupal.
That said, I believe views is going to become a core module and any upgrades to this module will also have the effect of overwriting your changes.
Better solutions:
(1) submit this as a patch to the views module. If accepted, a simple upgrade to a new version of Views will solve the problem.
or (2) find a way to override this function as a part of a custom theme. Your changes won't be affected by future upgrades.
I'm not sure about how to override this function in a theme, but if I figure it out, I'll try and come back and post an update.
I'm relatively new to Drupal so I'm not that familar with how functions are overriden, but I'm pret
adding namespaces at theme level
modules/views/theme/views-view-rss.tpl.phpis the file that ends up printing the namespaces. This file can be copied to a variety of names in your theme directory depending on if you want to effect all of your feeds or just some subset of them, you can see the list by going to "theme information" on a feed in the views interface. If you wanted to change all feeds it looks like it could be copied tothemes/mytheme/views-view-rss--feed.tpl.php. Then you could either edit that file directly or create a corresponding theme_preprocess function and alter $vars['namespaces'] there.adding the namespace info worked for me, but missing a trailing
this line:
$namespaces = array('xmlns:dc="http://purl.org/dc/elements/1.1/"', 'xmlns:atom="http://www.w3.org/2005/Atom"');needs a trailing slash after Atom, then it works...
k
The above solutions did not
The above solutions did not work for me in D5. Still getting (title unknown) in Google Reader. The View has a title and line 128 of views_rss.module was changed to this
$namespaces = array('xmlns:dc="http://purl.org/dc/elements/1.1/"', 'xmlns:atom="http://www.w3.org/2005/Atom/"');
With and without trailing slashes, neither works.
My solution
Hi,
I had the same problem. After an hour or two I figured out that if I use http://www.example.com/rss.xml, the feed tittle displays in Google reader, but if I use http://example.com/rss.xml it doesn't. It seams that Google reader has a problem with urls without www (or probably subdomain). Hope this helps someone else.
I can confirm the www fixed
I can confirm the www fixed it for me, but it looks to me like a views bug: #943762: All rss displays have xml:base set according to first rss display
ironically...
removing the 'www' from my URL when adding it to Google Reader fixed the problem for me. weird.
D6 - use preprocess_views_view_rss()
Many of the above solutions suggest directly editing files from the Views module to add the necessary Atom namespace attribute, but that is not recommended since your changes will get overwritten when you update the module. A very simple alternative is to implement the preprocess function for the views-view-rss.tpl.php template in your custom theme (place this in template.php):
Note the
array_merge()so that the existing namespace attributes (provided by Views) don't get overwritten.