Add an RSS Feed

Although not as sought-after as they once were, RSS feeds can still be a useful addition to any site - if only to allow Google Webmasters to easily crawl it. Luckily, with Hugo this process is very simple as the functionality comes built in and ready to go for when you need it.

Step 1) You’ll need to make sure ‘RSS’ is listed in our outputs within your config.toml file.

1
2
[outputs]
  home = ["HTML", "RSS"]

Then, using the base xml template, you should be able to access it at /index.xml - on local this might show as:

1
http://localhost:1313/index.xml

Linking

You can link directly to this page for humans and robots alike, but if you want to list the rss feed for your posts you can add this snippet to the head element of your theme.

1
2
3
{{ with .OutputFormats.Get "rss" -}}
    {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}