Setting up core <item> elements

Last updated on
3 January 2023

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

This guide applies mainly to 2.x branches of Views RSS module, although some of the features described here were implemented in the most recent versions of 1.x-dev branches as well.

To have all the fields described below available, you first need to enable Views RSS: Core Elements submodule (included in main Views RSS package).

<title>

Use field:

  • in Drupal 6 (D6) - Node: Title
  • in D7 and D8 - Content: Title

In field configuration section:

  • uncheck Link this field to the original piece of content
  • you might want to check Strip HTML tags (in Rewrite results fieldset)

More information: RSS Specification and RSS Best Practices.

Use field:

  • D6: Node: Path
  • D7 and D8: Content: Path

In field configuration section (Rewrite results fieldset):

  • check Use absolute link (begins with "http://")

More information: RSS Specification and RSS Best Practices.

<description>

Use whichever field you want (any of textfields/textareas, for example Content: Body).

You might want to use Trimmed formatter to output only part of the full field content.

HTML is allowed in this element, and will be properly encoded by the module. Alternatively you might use Strip HTML tags option (available in the Rewrite results fieldset).

More information: RSS Specification and RSS Best Practices.

<author>

This element should contain author's email address.

In D7 and D8, start with adding Content: Author relationship.

Use field User: Email.

In field configuration section:

  • in Link this field select No link

In D7, optionally you can change Format to RSS email: with user name to get emails together with user names - like geo@herald.com (George Matesky) - instead of just email address.

Such formatter is not available in D8. To achieve the same result add new field User: Name. In Rewrite results fieldset enable Override the output of this field with custom text option, and enter something like [mail] ([name]) in the Text textarea (you might need to adapt token names to your specific configuration, also making sure that field order is correct to have both values available). Use this field for core <author> element.

More information: RSS Specification and RSS Best Practices.

<category>

Use field:

  • D6: Taxonomy: All terms
  • D7: Content: All taxonomy terms
  • D8: any taxonomy-related field (will work both with Taxonomy: All terms as well as Content: <vocabulary_name> fields)

In field configuration section:

  • in D6 and D7, in Display type select RSS <category> element
  • in D8 DO NOT use RSS category formatter provided by Drupal core, as it does not provide enough information for <category> element to be displayed properly by Views RSS, and it just won't work then.

    You might want to use Plain text formatter with a comma as a Simple separator (see Multiple field settings fieldset), as this format might be useful for other feed elements.

More information: RSS Specification and RSS Best Practices.

<comments>

Use field Node: Path or Content: Path in D7 and D8 (add another one, do not use the same one which you used for <link> element).

In field configuration section:

  • change Label to Comments Path (to be able to easily distinguish it later from first Path field)
  • check Use absolute link (begins with "http://")
  • check Rewrite the output of this field and modify provided URL to your needs - for example entering something like [path_1]#comments

More information: RSS Specification and RSS Best Practices.

<enclosure>

In D6, use File field provided by FileField module (either File Upload or Image). Files added to nodes through core Upload module are not supported and will not be rendered correctly.

In D7, use standard Image, a File field, or a Link or Text field containing a URL with the media item.

In D6 and D7, select RSS <enclosure> element as field formatter.

In D8, DO NOT use RSS enclosure formatter.

Based on RSS 2.0 specification one <item> cannot have more than one <enclosure> element. Therefore if you have more than one file added to your File field in any of the nodes passed to the view, in the field configuration section you have to check Group multiple values and Show only 1 value. If you do not group, multiple <enclosure> items will be created for such node - as many as number of files attached to the node.

Also, in case of D6, if you enter more than 1 into Show value(s) field (or do not enter anything), theme function will add extra HTML which will break the feed.

More information: RSS Specification and RSS Best Practices.

<guid>

Use whatever value you want, just make sure that it will uniquely identify the feed item (node).

Most usually feeds use the same value for <path> and for <guid> elements.

isPermaLink attribute is automatically added to this 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.

More information: RSS Specification and RSS Best Practices.

<pubDate>

Use field Node: Post date (D6), Content: Post date (D7) or Content: Authored on (D8).

In field configuration section:

  • in Date format select Custom
  • in Custom date format enter r for RFC 2822 formatted date

More information: RSS Specification and RSS Best Practices.

<source>

Generated automatically by the module.

More information: RSS Specification and RSS Best Practices.

Help improve this page

Page status: Not set

You can: