Hugo defaults to filling your follow with the summary of every post. I prefer the full content of the most recent posts. Today I make my RSS feed reflect my preferences.
The Problem
Hugo RSS feeds have minor quirks that annoy me.
First off, it includes every page and post by default. The site content includes posts going all the way back to the year 2000. Most sites I subscribe to on Feedly show only the most recent posts. I want to do the same here.
Also, Hugo uses the .Summary
of my content in the description for each item of the feed. There’s nothing wrong with this, but I like being able to read a full post without leaving Feedly - or whatever I use for RSS this week.
A Solution
The Hugo RSS Template documentation tells me what I need to know. I can change the entry count in site config, and handle the content of each entry with a template.
Limit Entry Count
Just the relevant bits of my config.json
. Twenty entries seems like a good arbitrary value.
All The Content
All I need to do here is copy the default RSS template into layouts/_default/rss.xml
, then make my changes.
My changes are small indeed. I place the post .Content
in the description instead of the .Summary
.
The full entry looks like this.
NOTE
Updated for Hugo 0.57, which changed how
.Pages
worked. Now use.RegularPages
, and for top-level RSS use.Site.RegularPages
That ought to do it.
What Else?
What else I could do with the feed?
- This RSS Best Practices Profile includes things I could tweak in my RSS template, though that’s more about nice form than any urgent need.
- Raymond Camden wrote a post about adding a JSON Feed to your Hugo site. It might be fun to do that here.
Backlinks
Got a comment? A question? More of a comment than a question?
Talk to me about this page on:
Added to vault 2024-01-15. Updated on 2024-02-01