DEV Community

loading...

Adding an RSS feed to GitHub Pages

dzhavat profile image Dzhavat Ushev Originally published at dzhavat.github.io ・2 min read

This post was originally published on my blog.


Yesterday I decided to add an RSS feed to my blog. I hoped that it was going to be easy since the blog is build with Jekyll and hosted on GitHub Pages. There must be something already build-in, right?

Well, it turned out that there was! And the setup was a piece of cake 🍰

Here are the steps that I took:

  • Opened the _config.yml file and added the following lines:
plugins:
  - jekyll-feed
title: Dzhavat Ushev’s blog
description: Welcome to my blog
author: Dzhavat Ushev

Apparently, GitHub Pages supports a list of plugins but not all of them are enabled by default. jekyll-feed is one of them. To enable it, the only thing I had to do was add it to plugins array in the _config.yml file.

After pushing this to GitHub, the site was rebuild and a feed.xml file was generated. I could access at site.github.io/feed.xml.

The properties title, description and author are optional. I added them because I wasn’t happy with the defaults. For more settings, check out the jekyll-feed repo.

  • The next step was to add this line in the head of all HTML layout files:
<link rel="alternate" type="application/atom+xml" title="{{ site.title }}" href="/feed.xml">

This helps if someone wants to subscribe to my blog using a feed reader, like Feedly.

  • The final step was to make a link to the feed that is accessible from each page. In my case this looked like this:
<a class="btn btn-rss" href="/feed.xml" target="_blank">RSS</a>

That’s it! This took me just a few minutes to figure this out and now I have an RSS feed of my posts. Subscribe if you want to read them. 😊

Discussion

pic
Editor guide