RSS Module Tags

Note:  We have provided RSS Templates for the most common RSS versions, since building an RSS feed from scratch can be a little tricky.

The main purpose of the RSS tag is to render the top portion of the feed containing the name of the author, the character encoding, etc., while the main weblog tag renders the actual rows.

The RSS Module Tag is intended to be used in conjunction with the Weblog Entries tag.

The entire RSS feed is enclosed between the following tags:

{exp:rss:feed}

{/exp:rss:feed}

Parameters

If you use any of the following parameters, you will probably want to mirror the same settings for your {exp:weblog:entries} tag contained inside the RSS tag.

status=

status="open"

You may restrict to a particular status. You can choose multiple statuses using a pipe:

status="draft|reviewed|published"

Or exclude statuses using "not"

status="not submitted|processing|closed"

username=

username="petunia"

This parameter limits the query by username. You can use the pipe character to query by multiple usernames:

username="tom|dick|harry"

Or you can add "not" to exclude usernames:

username="not tom|dick|harry|fred" You can also use the constant "CURRENT_USER" to show entries from only the currently logged in user.

username="CURRENT_USER"

This allow each logged-in user to get only their entries. Users who are not logged in won't see anything. Alternatively, you can use the constant "NOT_CURRENT_USER" to show entries except from the currently logged in user.

username="NOT_CURRENT_USER"

weblog=

weblog="which"

From which weblog to show the meta data information. You must specify a single weblog.

show_expired=

show_expired="yes"

You can determine whether you wish for entries that have "expired" to be included.

show_future_entries=

show_future_entries="yes"

You can determine whether you wish for entries dated in the "future" to be included. This option is useful when doing things like creating a list of events, some of which have not occurred yet. Note that EE will still display past entries; this parameter simply instructs EE to also include entries from the future.

Variables

author

{author}

The name of the person who submitted the last entry.

email

{email}

The email of the person submitting the very last entry.

encoding

{encoding}

The XML character encoding for the weblog.

version

{version}

The version of ExpressionEngine that you are using (1.0, 1.1, etc.). This data is pulled from system/core/core.system.php.

weblog_description

{weblog_description}

The description of the weblog.

weblog_id

{weblog_id}

ID number of the weblog (not the weblog entry, the actual blog).

weblog_language

{weblog_language}

The code for the language the weblog is in (en-us, etc.).

weblog_name

{weblog_name}

The name of the weblog.

weblog_url

{weblog_url}

The URL associated with the weblog as set in the "Weblog URL" preference under Weblog Management.

Single Variable Dates

Several date variables are available for use. As with other date variables, these require the "format" parameter in order to define how the date should be displayed. See the date variable formatting page for more information.

date

{date format="%Y %m %d"}

The date on which the last entry was submitted. Note: as with all dates, the formatting codes are necessary: {date format="%Y"}

edit_date

{edit_date format="%Y %m %d"}

The date on which the entry was last edited.

gmt_entry_date

{gmt_date format="%Y %m %d"}

The date the entry was submitted in GMT. This variable is not localized for each user's date settings.

gmt_edit_date

{gmt_edit_date format="%Y %m %d"}

The date on which the entry was last edited in GMT. This variable is not localized for each user's date settings.

RFC3229 Support

ExpressionEngine has the ability to serve only new content if it receives an RFC3229-compliant request (RFC3229 info). This means that programs or servers that are configured to do so can request to only see new content that has been produced since the last time it requested a feed and EE will provide only that new content. This allows you to reduce bandwidth costs and download time by only serving the necessary content.

This ability is provided by adding a special parameter to the {exp:weblog:entries} opening tag, dynamic_start="on". It is used like so:

{exp:weblog:entries weblog="default_site" limit="10" rdf="off" dynamic_start="on"}

Empty Feeds and Errors

If the combination of tag parameters you specify leads to an error or an empty feed, ExpressionEngine will output a valid, empty RSS feed for you. If you'd like to display the tag errors in this default feed to help troubleshoot why no entries are available, you can put the RSS module into debug mode by adding the debug= parameter:

{exp:rss:feed weblog="default_site" debug="yes"}

If you want, you can also specify your own feed to use in place of the default, with the option of displaying the tag error as well, using the {if empty_feed} conditional. Tag errors can be displayed with the {error} variable.:

{if empty_feed}
<?xml version="1.0" encoding="{charset}"?>
<rss version="2.0">
   <channel>
   <title>{site_name}</title>
   <link>{site_url}</link>
   <description>{site_name}</description>

   <item>
     <title>Feed Error</title>
     <description>{error}</description>
   </item>
   </channel>
</rss>
{/if}

Top of Page

User Contributed Notes

Posted by: GDmac on 20 April 2008 6:45am
GDmac's avatar

You can use entries from multiple weblogs to make a single RSS feed.
If you have different fieldsets for the weblogs, then you can use
conditionals to insert the correct field into the feed.

{assign_variable:master_weblog_name="news|blog"}
{exp
:rss:feed weblog="{master_weblog_name}"}
...
{if weblog_id==1}{news_field}
{if
:elseif weblog_id==2}{blog_field}
{
/if}

forum thread: Creating a single RSS feed for multiple weblogs

Posted by: Jan_Huygens on 29 October 2007 11:02am
Jan_Huygens's avatar

If your weblog uses the ‘entry_date’ and ‘expiration_date’ in the entries [and the entries are all past and/or future events], then make sure that you use one or both of the parameters:
- show_expired=“yes”
- show_future_entries=“yes”
in the {exp:rss:feed }” tag
[as appropriate]

Otherwise you can get the error message ‘the weblog specified in your RSS feed does not exist.’, even if it does exist and has entries.

this can be a real source of mystification if you are trying RSS feeds for the first time!

PS you will probably want to add ‘show_future_entries=“yes”’ to the {exp:weblog:entries} tag otherwise you won’t see future events in the feed when you create them!

Posted by: Magnus Wester on 19 July 2007 7:14am
Magnus Wester's avatar

The current RSS 2.0 template deserves a few comments:
- You must replace “default_site” with your own weblog name.
- In the <item> container, there is a reference to title_permalink=site/index. You should replace “site” with the name of your template group, and “index” with the name of the template that you use for showing one entire post (e.g. “comments”, “read”, “article”). It is however highly unlikely that it is called “index” as in the template.
- The template includes two custom fields called “summary” and “body” in the feed. If you are using other names for the custom fields in your weblog, you must of course use these field names instead.
- You may want to consider showing only the summary portion of your post, to have people click through to view the entire post, including other custom fields, images, comments and advertisements, on your site.

You must have an ExpressionEngine license and have attained a forum rank of "Lab Assistant" (100 posts) to contribute notes to the User Guide