Question

We are using the Feed Display for a view where we want to display all Articles in a rss.xml file. Below are the View settings. However, we cannot find a way to add an image attribute that meeting the RSS 2.0 specs.

How can we add an image to the RSS feed display?

View settings:

  1. Format: Rss Feed
  2. Show: Fields | Settings
  3. Fields: content: title, content: body, tracker: updated date, content: link to content, content: authored by
  4. Feed settings: path = some/path/rss.xml
  5. Filter criteria: published = yes and Content type = Articles

When you click on settings in the Show section, we assigned the fields.

  1. title field -> content: title
  2. link field -> content: link to content
  3. description field -> content: body
  4. creator field -> content: authored by
  5. publication date field -> tracker: updated date

What we tried:

  • Include field_image under fields and hide from display
  • Rewrite the output of the body to include the following <enclosure url="{{field_image}}" length="100" type="image/jpg" />
  • The {{ field_image }} is the available token after reordering field image under Fields section so that it is above body field.

Results of what we tried:

<description>some body text **blank space where <enclosure> should display** </description>

Expected output (cannot get this result because <enclosure> is stripped even when Strip HTML is false):

<description>some body text</description> <enclosure url="{{field_image}}" length="100" type="image/jpg" />

Was it helpful?

Solution

I found there is a patch that works for exactly what we need. Support enclosure field in Views RssFields row plugin

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top