Getting started
Sections
Help

RSS

From Snowfire Wiki

Jump to: navigation, search


How to create an RSS feed

Let's say you have two different layout files. One called news.tpl which is a list of all news items. Then you have news-single.tpl in which you create every news post. Now we want to add an RSS feed in news.tpl which contains all news posts.


Settings

Create news-single.xml in your layout/layouts folder. It must have the same name as your layout file (news-single in my case) and end with .xml

This file should include the following code:

<?xml version="1.0" encoding="utf-8"?>
<layout>
	<settings>
		<children>
			<layouts>
				<layout>news-single.tpl</layout>
			</layouts>
			<contentType>
				<singular>News entry</singular>
				<plural>News entries</plural>
			</contentType>
		</children>
		<noAddToMenu>true</noAddToMenu>
	</settings>
	<childrenRss>
		<title>My news feed</title>
		<description></description>
		<copyright></copyright>
		<item>
			<content type="html-id">entry</content>
		</item>
	</childrenRss>
</layout>

This tells Snowfire that every news entry is created with the news-single.tpl layout file and that it won't show up as a meny option (hey, we don't want a main menu or dropdown with all our news items). Title is set to "My news feed" as is the title of the page, we recommend that you name it to "[Your company name] feed" if you only have one.

The
<content type="html-id">entry</content>
tells us that Snowfire will look for a HTML id called "entry" inside news-single.tpl.

Example of news-single.tpl:

<div id="entry">
	<div class="date">{ var_publishedDate }</div>
	{ com_singlerow(id:'1', description:'News headline', class:'tk-myriad-pro', htmlElement:'h2', key:'headline') }
	{ com_image(id:'2', description:'Optional image', maxHeight:'255', maxWidth:'500', key:'newsimage', crop:'true', enableVideo:'true') }
	{ com_wysiwyg(id:'3', description:'Content', key:'body', enableLists:'true', customBlockformats:'blockquote' ) }
</div>

Enable RSS

Now when you have created the xml file pointed it to a HTML id it's time to login to Snowfire. Go to all your pages and edit settings for the page you've created with the news.tpl file. Then find the "Enable RSS" button which will enable the RSS feed you have configured.

File:page-settings.jpg


Now you are done!

Navigate to your website and you'll see the following code in your source code:

<link rel="alternate" type="application/rss+xml" href="/news/rss" title="mimmin feed" />

That makes it easy for RSS readers to find your feed.

Views
Personal tools