How to: Implement an RSS feed with Hugo

Here is a guide to help you add an RSS feed to your Hugo blog.
1. Edit the config.toml file:

a. Make sure the baseURL is valid (e.g. "https://leahchung.netlify.com")
b. Add the following lines:
[outputs] home = [ "RSS", "HTML"]

[outputFormats] [outputFormats.RSS] mediatype = "application/rss" baseName = "rss"

2. Edit the header.html file.

a. Add the following line:
<link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" />
I added this in my 'header-widget' div, but this will depend on your theme.

3. Add an rss.xml file in the your_theme/layouts/ directory. Then add the code found here.

4. Add the following to the top of each post markdown file:

layout: rss

Voila! This should do the trick, but I suppose everyone's unique theme will create unique issues. I hope you found this post useful!


Last updated: