The Hugo static site generator sadly still uses the obsolete and badly standardized RSS format.
Here's how to set it up to generate an Atom feed instead. Pretty much all feed readers which understand RSS also understand Atom, except iTunes, and Atom is a better format.
- Define an appropriate media type and corresponding output format in
config.toml
:
[mediaTypes]
[mediaTypes."application/atom"]
suffix = "xml"
[outputFormats.Atom]
mediaType = "application/atom"
baseName = "index"
isPlainText = false
- Tell Hugo to produce the home page in Atom and HTML formats, also in
config.toml
:
[outputs]
home = [ "HTML", "Atom" ]
- Put an
index.atom.xml
template file in yourlayouts
directory. You can use the attached one as a starting point, don't forget to edit the author element appropriately or make it take the values from your config.
Thanks for this. The configuration was helpful. I had to make some adjustments to the template to get it to validate.
Update: I removed the
| html
part from{{ .Content | html }}
because escaping the content caused it to not render properly in my feed reader. The validators complain about thedata-lang
attributes that are there for syntax highlighting, but I think that's ok.