Blog RSS Feeds

RSS feeds make it easy for your customers to subscribe and get notified when you post a new article. It’s a particularly good way to build loyalty and be seen as a trustworthy source of information in your industry. This technique can be used to create RSS feeds for any content type in Neto. It could even be modified to provide a feed of new products!

How it works

A custom CMS template is applied to a new, hidden page. The template uses B@SE tags to directly generate the XML for the RSS feed. Then RSS autodiscovery tags are added to the site header to alert browsers to the feed.

Implementation

Create the RSS feed template

Add the following code to a new file at /templates/cms/rss_feed.template.html

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xml:base="[@config:home_url@]"
>

<channel>
	<title>[%url_info name:'page_heading' default:'[@content_name@]'/%]</title>
	<atom:link href="[@CONFIG:CANONICAL_URL@]" rel="self" type="application/rss+xml" />
	<link>[@config:home_url@]</link>
	<description>[@content_short_description1@]</description>
	<language>en</language>
	<sy:updatePeriod>daily</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
	  <url>[@config:home_url@]/assets/website_logo.png</url>
	  <title>[@content_name@]</title>
	  <link>[@config:home_url@]</link>
	</image>
	
[%thumb_list type:'content' content_type:'[@content_type_code@]' limit:'12' filter_category:'' sortby:'date_posted-desc'%]
	[%param *body%]
	  <item>
		<title>[@content_name@]</title>
		<link>[@URL@]</link>
		<guid>[@config:home_url@]/guid/[@content_type_code@]/[@content_id@]</guid>
		[%if [@date_posted@] > 0%]<pubDate>[@date_posted@]</pubDate>[%/if%]
		<description>
			[%if [@content_short_description1@] %]
				[@content_short_description1@]
			[%else%]
				[%format type:'text' rmhtml:'1' nohtml:'1' truemaxlength:'3000' %]
					[@content_description1@]
				[%/format%]...
			[%/if%]
		</description>
		<content:encoded><![CDATA[
		[@content_description1@]
		]]></content:encoded>
	  </item>
	[%/param%]
[%/thumb_list%]

</channel>
</rss>

Create the RSS page

Create a new blog post with:

  • The name you want displayed as your feed title
  • No parent category
  • Active
  • Not visible on menu or sitemap
  • Header template: none
  • Footer template: none
  • Body template: rss_feed
  • Set the URL to something convenient, like /blog.rss

Add the RSS Autodiscovery tag

Edit your site’s head section.
On older themes: /templates/headers/template.html
On newer themes: /templates/headers/includes/head.template.html

Add the following code to the head, changing the title to your blog name and the href to the URL of the page you just created.

<link rel="alternate" type="application/rss+xml" title="My company blog" href="[@config:home_url@]/blog.rss" />

Test it out

Now test our your RSS feed! First go to the URL of your feed and check that some content appears. Don’t worry that it is unformatted.

The raw, unformatted RSS feed

Now install an RSS reader. (like RSS Feed Reader for Chrome). Visit your homepage and the extension’s icon should indicate feeds are available. Add them to your reader and the content should appear.

Our two RSS feeds auto-discovered by RSS Feed Reader

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.