Textpattern CMS includes inbuilt functionality for syndication feeds, specifically RSS and Atom. At a high level, your readers can receive data feeds of articles from your site in a feed reader of their choice, be it an online service like Feedly or a locally-installed application like RSSOwl. Regardless of the type of feed reader, it’s important to understand the different ways Textpattern articles can be syndicated.
First off, should you choose to share your articles, they can be shared with RSS and Atom syntax. Most readers will process both RSS and Atom without any issue – whether you choose to use RSS or Atom is entirely down to you and your user base. I’ve seen more websites using RSS syndication than Atom, but I say that anecdotally instead of having evidence to back my claim up.
The important part of the above paragraph is the element of choice. The RSS and Atom functionality in Textpattern will only work as intended if the articles you want to share have syndication enabled. Specifically, an article requires a section and that section can have syndication turned on or off. To check whether your articles have syndication turned on or off, go to the Presentation tab in the admin-side panel, then Sections. This list displays your article section(s), but does not display the syndication information by default. You have two options: to see at-a-glance information, check the Show more detail checkbox in the lower right corner. This will show additional columns to the table, including one indicating whether syndication is enabled. The other option is to click on the section name, which will display the same information in a more succinct table.
When a section has syndication enabled, a subscription link can be shared. The following are all valid URLs for Textpattern syndication feeds, and are a small selection of what can be done:
These URLs can either be hand-coded as part of the design and construction phase of your site, or you can let the <txp:feed_link> take the strain and do some of the hard work for you. Let’s take a closer look at <txp:feed_link> and see how it works. If you want to have RSS and Atom links in your <head>, this is a valid use of <txp:feed_link>:
<txp:feed_link flavor="atom" format="link" label="Atom" /> <txp:feed_link flavor="rss" format="link" label="RSS" />
This code snippet is used in the Hive theme and when parsed will output this:
<link rel="alternate" type="application/atom+xml" title="Atom feed" href="http://example.com/atom/"> <link rel="alternate" type="application/rss+xml" title="RSS feed" href="http://example.com/atom/">
Conversely, if you want a URL link in your <body>, this is how it works:
<txp:feed_link flavor="atom" label="Atom" /> / <txp:feed_link flavor="rss" label="RSS" />
This code is shown as follows:
The difference is the format attribute. The former sets up a valid head tag, the latter presents some text linked to a URL. The <txp:feed_link> tag has a number of additional attributes that can be used alongside the flavor and label attributes – I’ll cover some of them in my next article.