Easy Way to Add RSS Feeds to Your Jekyll Site: No Plugins Required

Monday, 16 December 2019

This very website uses Jekyll and on this post you will see how easy is to add RSS Feeds (XML and JSON) to your Jekyll site without adding any third party plugins.

One of greatest Jekyll features is that any file can be a page or an endpoint route by adding the double of three dashes as the first lines of the file.

In our example, our both files will follow the pattern:


---
layout: null
permalink: /the-route-you-want.ext
---

By adding layout: null, we inform Jekyll that the file will behave as it is, but it will still have the power behind.

Let’s assume that your posts have the required information like title, permalink, external_url, etc., to work as seen in both feeds bellow. The feed will run through your posts and format the file accordingly.

Having them under your control allows you to customize them the way you want with the information you’re willing to expose.

XML Feed

The XML Feed needs to follow the Atom Convention.

JSON Feed

The JSON Feed will conform to JSON Feed Convention.

You can also do a similar thing for the sitemap of your website.

You can check the results right here.

Taking an iPhone and a Canon on a Trip »