Welcome to the OpenCities help centre. Search for what you're after, or browse the categories.
Can't find what you're looking for? Submit a support ticket and we'll be in touch.


Creating an RSS feed

avatar of Kira Hartley

Kira Hartley

Last updated

This task is for users with the following roles: OC Developer.

In OpenCities, you can create content lists or RSS feeds. Both options consume data from your site's content and display it, but while content lists are used to list content from your site on other pages of your site, RSS feeds are better suited to consume OpenCities data and display it somewhere else.

For example, you could create an RSS feed that displays news, events, meetings, or general updates for your city or council. Your residents could then use the RSS link with an RSS reader to display a simple list of content that would link back to your site, or another website could use the link to display your content.

This article will go through creating an RSS feed, using the example of listing OC News Article pages outside of the site. The feed will present links to news articles on your site, displaying the title, page activation date, and a short description.

  1. Go to More > Content Lists from your main menu and select Create New Content List.
  2. Give your list a Name, and make sure you check RSS Feeds under List type.
  3. Choose your other settings in the Overview tab, then check OC News Article under Type of content to list.
  4. Switch over to the Sort & Filter tab and select your General, Sort options and Search Parameters settings. You may want to include news from different sites; check all that apply under General > Content groups.
  5. Under Sort options, we recommend using the following to display your content by the most recently activated first:
  6. Field: Activate Date
  7. Sorting Method: Start Date
  8. Direction: Desc
  9. For Edit Template options, only Body Top, Item, and Body Bottom are relevant, as RSS is just for listing, and we don't need to worry about presentation. RSS feeds are used to output data in a format that is friendly for other applications. Use the relevant code snippets below to input your data into each template.
  10. Save your list.
  11. To add an RSS feed to a page, you'll need to go to the WYSIWYG Editor of the page and select the Hyperlink Manager icon in the WYSIWYG toolbar.
  12. Go to the InternalLink tab, open RSS links in the content tree, and select the feed name.
  13.  Select any further options in the Hyperlink tab.
  14. Select OK and Save Content And Close. Save, Preview and Publish your page when you're ready.

Sample code snippets

The following snippets show you how to build a template for your RSS feed. You may have to build a few field templates to render data as you want to, and you can play around with what fields are displayed using the Template part dropdown menu.

Body top template

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
		<title>City of Point Russell News Feed</title>
		<description>City of Point Russell News</description>
		<generator>City of Point Russell News</generator>
		<atom:link href="http://pointrussell.opencities.com/feed.rss?listname=News%20RSS%20feed" rel="self" type="application/rss+xml" />

Item template

	<title><![CDATA[<ItemData DataDefinition="OC Title" Template="OC Name If Empty" />]]></title>
	<link><![CDATA[<ItemData DataDefinition="Link" Template="default" />]]></link>
	<guid><![CDATA[<ItemData DataDefinition="Link" Template="default" />]]></guid>
	<pubDate><ItemData DataDefinition="Activate Date" Template="RSS date" /></pubDate>
	<description><![CDATA[<ItemData DataDefinition="OC Short Description" Template="default" />]]></description>

Body bottom template

Was this article helpful?
0 out of 0 found this helpful