/ by Marek /

Growing our RSS Feed

This website is built using a static site generator. SSGs are a great fit for us because:

  • our website is like a brochure, with no dynamic elements
  • we value the efficiency of building the HTML in one shot, rather than a content management system rendering each page view in real-time
  • the “attack surface” of our website is minimised, because there is no content management system to secure
  • we can use traditional software development tools such as revision control systems

When we built this site, at the same time we launched with our new branding, we decided to adopt Grow. It parses our markdown content and renders it into HTML via Jinja2 templates. Grow is written in Python, a popular and flexible programming language which we’ve got years of experience using.

To make an RSS feed of our news and blog pages we created an additional page of content:

$title@: Faelix Blog and News Feed
  nav: News Feed
$view: /views/rss.xml
$hidden: true
$path: /news.xml

description: "News articles and blog posts by the team at FAELIX."

    link: /news/
    language: en-gb
    rating: '(PICS-1.1 "" l gen true by "" on "2021.01.23T10:150000" for "" r (Com 1 SF -1 Can 0 Edu -1 V 0 P 0 Env -1 S 0 Gam -1 MC -1 Tol -1 ))'
    ttl: 86400
    managingEditor: ' (FAELIX RSS Editor)'
    webMaster: ' (FAELIX RSS Webmaster)'
        url: /static/images/favicon/rss-icon-144x144.png
        width: 144
        height: 144
    posts: 8

That page is rendered through the following view to generate an RSS 2.0 XML file:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="">
        <atom:link href="{{ doc.url }}" rel="self" type="application/rss+xml" />

        <title>{{ or doc.title }}</title>
        <link>{{ }}</link>
        <description>{{ or doc.description }}</description>

        <language>{{ }}</language>
        <rating>{{ }}</rating>
        <copyright>Faelix Consultancy Services 2003-2006, Faelix Limited 2006-{{ None|datetime('Y') }}</copyright>

        <pubDate>{{ ('news', order_by='collection_path')|reverse|first).dates.published.strftime('%a, %d %b %Y %H:%M:%S') }} +0000</pubDate>
        <lastBuildDate>{{ None|datetime('EE, dd MMM Y HH:MM:SS') }} +0000</lastBuildDate>

        <docs>{{ }}</docs>
        <ttl>{{ or 86400 }}</ttl>
        <managingEditor>{{ }}</managingEditor>
        <webMaster>{{ }}</webMaster>

        {% if %}
            <title>{{ or or doc.title }}</title>
            <url>{{ }}</url>
            <link>{% if == podspec.meta.livedomain %}{{ env.scheme }}://{{ }}{% endif %}{{ or }}</link>

            <width>{{ }}</width>
            <height>{{ }}</height>
            <description>{{ or or doc.description }}</description>
        {% endif %}

        {% for post in ('news', order_by='collection_path')|reverse|list)[] %}
                <title>{{ post.title }}</title>
                <link>{{ post.url }}</link>
                <description>{{ post.description }}</description>

                <author>{{ }} ({{ }})</author>
                {% for tag in post.tags %}<category>{{ tag }}</category>
                {% endfor %}

                <guid>{{ post.url }}</guid>
                <pubDate>{{ post.dates.published.strftime('%a, %d %b %Y %H:%M:%S') }} +0000</pubDate>

                <source url="{{ post.url }}">{{ post.title }} — {{ podspec.title }}</source>
        {% endfor %}

And that’s all there is to it!