Technical blog from Craig Russell.
This post details how to include the author tag in the generated RSS feed for a Hugo-generated site.
Hugo comes equipped with a template by default. In fact you might be pleasantly surprised to discover your site has an RSS feed already. You can try it out by visiting your site and adding /index.xml
on the end of either of your home page, or your section containing your blog posts. e.g.,
While the default template might be enough for some, others are going to want to customise it. For me, I found that I wanted to include an <author>
tag in my posts.
You can either grab the default template and add the <author>
tag into it (recommended approach) or just skip ahead and grab my one from the gist below. I would recommend using the default one as it may contain newer changes from Hugo that my gist won’t have over time.
To do this, we must start by grabbing a copy of the embedded RSS template. We’ll drop that into your project and customise it to include the author tag.
layouts/_default/rss.xml
<author>
tag in. You’ll probably want to add it under the <item>
tag, and you may additionally want to add it at the top level.config.yaml
, config.toml
or config.json
file)When you’re done, it should look like this 👇
// config.yaml
author:
name: Craig Russell
Now when you publish the site and access the RSS XML, you’ll see the <author>
is now included.