What's on this page
Publish an RSS or JSON feed
Cecil renders feeds with output formats: by default, the home page, sections and taxonomy terms are already published in HTML and Atom (e.g. /atom.xml, /blog/atom.xml). Add the rss or jsonfeed formats to publish RSS 2.0 or JSON Feed files too.
Enable feeds for all list pages
Set the formats applied to each page type with output.pagetypeformats:
output:
pagetypeformats:
homepage: [html, atom, rss, jsonfeed]
section: [html, atom, rss, jsonfeed] Cecil now generates rss.xml and feed.json next to each index.html of the home page and sections (e.g. /blog/rss.xml, /blog/feed.json).
Enable a feed for a single section
To publish a feed only for one section, use the output variable in the front matter of the section index page:
---
title: Blog
output: [html, rss]
--- Advertise the feed
If your templates include the metatags partial, <link rel="alternate"> tags pointing to the feeds of the current page are added automatically in the <head>.
Otherwise, add the link yourself with the url() function and its format option:
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ url(page, {canonical: true, format: 'rss'}) }}"> Customize the feed template
Feeds are rendered by the built-in templates _default/list.rss.twig, _default/list.atom.twig and _default/list.jsonfeed.twig. Following the lookup rules, create layouts/list.rss.twig (all list pages) or layouts/blog/list.rss.twig (blog section only) to override them.
You can extend the built-in template and redefine only the item block, for example to publish an excerpt instead of the full content:
{% extends '_default/list.rss.twig' %}
{% block item %}
<guid>{{ url(item, {canonical: true}) }}</guid>
<title>{{ item.title|e }}</title>
<pubDate>{{ item.date|date('r') }}</pubDate>
<link>{{ url(item, {canonical: true}) }}</link>
<description><![CDATA[{{ item.content|excerpt_html }}]]></description>
{% endblock %}