Mastodon

How to Set Up RSS for Your Statamic Website

Posted by Matt Birchler
— 1 min read

Statamic is a wonderful web platform. I used to run this site on it and adore just about everything about it. One of the few things I don’t like is that it doesn’t take care of RSS as easily as something like Wordpress or Tumblr, and setting RSS up yourself takes a few steps.

Since there doesn’t seem to be a great tutorial out there on how to do this, I thought I’d put together my own. Enjoy!

Here we go!


Download the files here


1. Add the head tag

We need to add one line of code to _themes/YOURTHEME/layouts/default.html. In thetag of this file, add the line:

 

<link rel=“alternate” type=“application/rss+xml” href=“{{ _site_url }}/feed” title=“XXXXXXXXXXX” />

Obviously, replace the XXXXXXXXXX with the name of your site. This step enables browsers to find the RSS feed on your site. The rest of this is moot if you don’t do this.

 

2. Move the 3 provided files into your site.

  • feed.md goes in your content folder
  • feed.html (in the “layout” folder) goes in themes/YOURTHEME/layouts
  • feed.html (in the “templates” folder) goes in _themes/YOURTHEME/templates
 

3. Make your edits

As convenient as it would be, these files won’t quite get the job done without any work: we do have to edit the feed.html file in the templates folder.

There are 3 things you must edit in this file (denoted by “XXXXXXXXXXXXX”) and everything else will take care of itself.

  • Title: the name of your site
  • Description: your site’s tagline, usually
  • Webmaster: email address and your full name
OPTIONAL: If you don’t want the entirety of your posts to show up in the feed, you can replace content|widont with summary.

Hopefully this was easy to follow and worked great for you. If you have any questions, reach out to me on Twitter.