Configure Hugo XML Output for RSS Feed


Why

I have a mysql db that will be used to store values read from the rss feed of my hugo site. I need some add some keys to help with organization

Parts of this series

  1. part 1
  2. part 2
  3. part 3
  4. part 4

Resources

RSS Config

Copy over the posts/rss.xml file from your theme

From hugo root you would do something like…


mkdir layouts && mkdir layouts/posts && cp themes/[theme]/layouts/posts/index.xml

Modify the rss.xml file

Add post id

Hugo supports a hash of the files path. It is not always unique… but for my purposes it will likely be good enough.

<postid> {{ .File.UniqueID }}</postid>

Add the author’s name when defined

{{ with .Site.Params.author.name }}<author_name>{{.}}</author_name>{{end}}

Add the author email when defined


      {{ with .Site.Params.author.email }}<author_email>{{.}}</author_email>{{end}}

Add a hash of the author email when defined

{{ with .Site.Params.author.email }}<author_id>{{sha256 .}}</author_id>{{end}}

The entire file

The most up to date rss file is found at this github link