Configure Hugo XML Output for RSS Feed
Hugo Custom RSS for my reader
44 Seconds
2024-06-28 00:00 +0000
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
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