I've searched the views rss issues, but could not directly find an explanation.

I have a content type, which has the following two fields for teaser:
(admin/structure/types/manage/chart/display/teaser)

  1. a thumbnail (Image style: square_thumb_crop, linked to content)
  2. teaser-text (plain text)

I want to create an RSS feed that contains, per entry, a title, that thumbnail and teaser text. So I've set my settings to:

Format: RSS Feed | Settings
Show: Content | Title plus teaser

However, whatever I do, it seems to grab the full node/default display content. (Title, teaser-text, a field that holds flash embed, and so forth - and not the thumbnail (which is set to hidden on default node display.)

The xml feed would be used to pass on to another site, which would use the title, thumbnail and teaser text to link back to us. So giving them a 'default display feed' (without the thumbnails) is no use.. .

Any help/hint would be greatly appreciated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vint’s picture

Category: support » bug
vint’s picture

Solved locally by using Display Suite ( http://drupal.org/project/ds ) to change the output of the default RSS for that node-type. Still not sure if this is how it is supposed to be done / why it never grabbed the 'teaser' display correctly.

renat’s picture

Version: 7.x-3.0-rc1 » 7.x-3.x-dev

Confirm this problem with 7.x-3.x-dev (2011-Oct-15).

resplin’s picture

I also see this problem with Drupal 7.7 and 7.x-3.0-rc1. Views appears to ignore the teaser configuration and populates the template's $description with the full node contents. However setting it to Title-only works, so only the teaser is affected.

resplin’s picture

JeremyFrench found a solution for me.

There is no code for the title plus teaser in views, but it does a node_build_content($node, 'rss').

We defined a custom display for our content type:
* Structure -> Content Types -> Manage Displays
* Under "Custom Display Settings" select "RSS"
* Then configure your RSS display to only show the Description as "Summary or trimmed".
* Under Views -> Feed -> Format -> Show, select "Full text"

It should now show your RSS custom display setting.

The process is pretty clean, it is just that the interface is misleading on this topic.

merlinofchaos’s picture

Things have changed here from D6 to D7, and I believe even core has a bug here because it still has a setting that is not actually respected. It's going to take some effort to figure out the right way to do this going forward, but it appears that resplin has posted an acceptable workaround for the moment.

renat’s picture

Confirm, workaround from #5 works very well. Thank you, JeremyFrench and resplin.

bobthebuilder’s picture

resplin workaround worked for me, however, now I'm not able to get Full Text to work since the View is using the RSS version of the node. I need to build a Head Only, Teaser, and Full Text rss feed for a particular node. From what I've gathered, I have to choose between Teaser and Full Text. Or am I missing something here?

resplin’s picture

Accidentally posted twice.

resplin’s picture

I used field display, and in the settings configured two views of content, one which I truncated like a teaser and one which I left full-length. I did this because I didn't see a Teaser field.

This is not a good solution because if a node has a summary it will be ignored. But it is the best I could find.

It looks like a teaser field was added in D6, but I don't see it in D7. I thought I found an issue about this earlier, so I didn't report it, but I can't find it now.

JeremyFrench’s picture

Status: Active » Needs review
FileSize
2.42 KB

I've attached a patch.

In D6 'title + teaser' made sense as there was always a body field from which you could deduce a teaser. In D7, nodes don't have to have a body, or can have multiple fields which work like a body.

Display modes are used in D7 to allow for different views, the default display modes defined in the node module are 'full', 'teaser' and 'rss'.

I have updated the options drop down to clarify this, and changed the code so that it will use the mode selected. Title only also still works and makes sense as nodes do still have a title.

I also changed $item_length in the code to be $display_mode as $item_length didn't really make sense. I kept the view setting with this name to preserve backward compatibility.

@merlin, I couldn't find a core issue for this if you can point me at it I can patch there too.

RSS namespaces were a bit of a quandry. In RSS mode $node->rss_namespaces may be populated, so I used this, if this isn't populated I use the default rdf_get_namespaces(), I figured that too many namespaces was better than too few (which would be invalid)

Kevin Morse’s picture

Not sure if it's helpful but with 7.x-3.0-rc1 my View appears to respect turning off and on most fields in addition to displaying Labels by using the Manage Display / RSS option.

The problem I'm having is that I can't seem to turn off display of the Language English, regardless of what the Manage display / RSS options say.

This is also being discussed at http://drupal.org/node/1209478 I'm not sure if these issues are both related or not but it kind of seems so. If it isn't I apologize for any misdirection.

Update: Here is an example from a feed on one of my sites. After HTML is stripped it looks like this:

NBA Lockout
Language English Negotiations entering critical stages. Commissioner threatening to cancel season. 简体中文 繁體中文 Español

Notice the Language English as well as the links to the three other languages. The RSS feed is basically useless right now unless I can filter that out on my main site or on the other Drupal sites which I would like to have aggregating this feed.

JeremyFrench’s picture

Hi Kevin. Looking at the issue #1209478: Language in RSS description still visible after hiding it may be related to this. At least in the initial description.

The default rss settings are 'teaser' if no variable is set, so if your teaser view has the language display being shown it could be the cause. (it looks like there may be other issues going on there as well).

Did you want to try out my patch from #11 and see if it helps you at all?

selcuk_erdem’s picture

The RSS feed is basically useless right now unless I can filter that out on my main site or on the other Drupal sites which I would like to have uydunet aggregating this feed.

JeremyFrench’s picture

@selcuk_erdem, this issue is marked as 'needs review' which means there is a patch available which may resolve it. You could help Drupal by testing this patch to see if it resolves the issue for you.

There is a work around as well (See #5).

If either of these things is not working for you, please could you state why, and the community may be able help resolve the issue.

merlinofchaos’s picture

On the patch: I believe we can fetch a list of view modes rather than hardcoding the available modes. Otherwise this seems like the best solution. If you can modify it like that I believe it can be committed.

dawehner’s picture

+++ b/modules/node/views_plugin_row_node_rss.incundefined
@@ -112,19 +113,37 @@ class views_plugin_row_node_rss extends views_plugin_row {
+    else {
+      $this->view->style_plugin->namespaces = array_merge($this->view->style_plugin->namespaces, rdf_get_namespaces());

Can you please explain this change? This seems to be slighly unrelated to this issue.

+++ b/modules/node/views_plugin_row_node_rss.incundefined
@@ -112,19 +113,37 @@ class views_plugin_row_node_rss extends views_plugin_row {
+    if ($display_mode != 'title') {

I like the new name of the variable!

Okay so i implemented this general fetching of the build modes, and simplified some parts of the code.

JeremyFrench’s picture

Thanks for the tidy up. The only thing which may have been missed is that some views may have a length of "fulltext"prior to this patch. I'm not sure how they will be displayed as that isn't a valid display mode.

The rdf line is to try to keep the xml valid. I think if you didn't include it. There could be namespaces in the feed which are not declared.

dawehner’s picture

Oh i wrote some kind of conversion code:

+    if ($this->options['item_length'] == 'fulltext') {
+      $this->options['item_length'] = 'full';
+    }
JeremyFrench’s picture

Sorry, shoudn't have looked at the patch last thing at night. Full text thing is fine.

Did a bit of testing re the namespace thing. At the moment everything is put as escaped html into the description field. I have no idea how different user agents respect namespaces in the rendered markup, it it won't make the rss invalid xml in any case. So we don't need to worry about it.

I'm happy with the patch as it stands, but as it is based on mine I won't RBTC it.

dawehner’s picture

You know the reality shows that in all queues beside drupal core waiting for someone testing or reviewing a patch is pretty hopeless.

@dereine
Add the rdf namespace part and commit it

renat’s picture

Patch from #17 works well for me. Thank you for fixing this problem!

Kevin Morse’s picture

Which patch should I be testing? The one from #17 or the one from #11? I'm assuming #17 is just an improvement?

JeremyFrench’s picture

#17 is better, pulls in the display types rather than hard coding.

scito’s picture

FileSize
2.92 KB
+++ b/modules/node/views_plugin_row_node_rss.inc
@@ -25,6 +25,17 @@ class views_plugin_row_node_rss extends views_plugin_row {
+  function init($view, &$display, $options = NULL) {

$view should be &$view for PHP 5.3. If this is not the case, a strict warning is shown.

Warning:

Strict warning: Declaration of views_plugin_row_node_rss::init() should be compatible with that of views_plugin_row::init() in _registry_check_code() (Line 2977 from .../includes/bootstrap.inc).

Additionally, I've added the rdf namespace part as of comment #21.

Kevin Morse’s picture

Finally duplicated the production site with the RSS feed, figured out how to apply git patches, duplicated the RSS client site and discovered my issue has been fixed in one of the recent updates I've done. Thanks all for your time and the hard work you put into developing this module.

marktheshark’s picture

Also in need of a way to have the RSS feed use the teaser instead of the full node. Following...

dawehner’s picture

Status: Needs review » Fixed

So this patch looks fine and works fine for a simple node_rss view, so committed it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

The more I try to resolve / work around this. The more I become convince it is a bug (as it does not grab the info it says it would), rather than an error on my side. But don't seem to be able to change status?