Custom R.S.S. Feed Format in Hugo

Share:

Jul 28, 2024 375 Words

Read Time: 2 Minutes

Custom R.S.S. Feed Format in Hugo

I recently noticed that I spend a lot more time on social media news feeds (a.k.a. beginning of rabbit holes than actually inside them). I mainly follow a self-curated list of people I admire and follow closely.

But social media is full of emotional triggers and distractions and using it for even 5 minutes messes up focus.

I fell back to the idea of R.S.S. feeds and installed a few readers on my machine so I could just read the “posts” from my curated list without the distractions of social media.

In the process, I too wanted to expose my long form (blog posts) to RSS protocol so that anyone who follows me either at present or in the future can benefit from it.

Anyway, my S.S.G. (Static Site Generator) tool “Hugo” already had the RSS feature built-in and is. enabled. However, I noticed that the format was broken (to me at least).

So, I spent nearly 30 minutes trying to understand how to fix the formatting and it turned out to be super simple 1. Another testament to Hugo’s simplicity.

For some reason, the default RSS.xml template didn’t include the actually content of the posts in the whitelisted sections. I wanted to fix that and It was really simple.

I only needed to copy the layout/_default/rss.xml from Hugo’s repository and modify it for my needs.

<description>{{ .Content | transform.XMLEscape | safeHTML}}</description>

I only had to update the description tag to use .Content instead of .Summary that was in the default.

During the build process after this tiny change (along with more formatting changes w.r.t. tags), I noticed that the transform.XMLEscape filter wasn’t supported in my local version of Hugo (v1.101.0)

So, I updated the version in my local with a simple process:

For local:

An uninstall step brew uninstall hugo followed by an install brew install hugo

For production:

A version upgrade to v1.121.0 in the netlify.toml file (my hugo blog is hosted on netlify.com)

After deployment, my RSS feed XML file was modified and now it contains the whole content neatly formatted with neatly annotated images.

A screenshot of my R.S.S. client in my desktop
➚ This beautiful screenshot was taken from my macOS app. Get it for yourself!

References:

Find more posts from following topics

2024
@binding
abbacchio
accurate-requests
anime
api-development
api-testing
api-testing-tools
array
automated-testing
bad-habits
base64-decoder
base64-encoder
biography
blog
blogging
books
browser
bulma-css
bulma.io
bulmacss
button-swiftui
chatgpt
chrome
clipboard
code
code-block
code-navigation
code-snippet
codecoverage
comparison
compile
computer-networks
configuring-debugger-for-django-in-vs-code
configuring-launch.json-for-python-debugger
copy
copy-to-clipboard
copy-to-clipboard-neovim
css
current-date
current-time
current-timestamp
database
debugger-setup-in-visual-studio-code
debugging-django-app-in-visual-studio-code
debugging-python-code-in-visual-studio-code
debugging-python-programs-with-visual-studio-code
debugging-python-with-virtual-environment-in-vs-code
developer-productivity
developers
development-workflow
django
django-rest-framework
dom
dynamic-sitemap-in-nextjs
encryption
engineering-dashboard
enumerate
fiction
flowcharts
generics
git
git-diff
github
global-keyboard-shorcut
global-shortcut
go
go-hugo
go-programming
go-test
go-to-line
go-tool
go1.18
golang
golang-development
golden-wind
good-habits
gorilla-websocket
gpt
gpt-3.5
gpt-4
gpt-4-api
guide
gumroad
habits
habits-tracker-notion-template
hamburger-menu
hotkeys
html
hugo
ide
image
image-sharing
image-tool-for-ios
imagerenderer
include-timestamp
integrated-development-environment
ios
ios-16
ios16
javascript
jojos-bizzarre-adventure
jump-to-definition
keyboard-shortcut
leonardo-da-vinci
linux
ls
lsp
macos
map
markdown
markdown-code
mental-programming
menu
menubarextra
mergesort
mermaid-syntax
mistake-tracker-notion
mobile-view
modifier
modulo-operation
navbar
navigationlink
navigationstack
neovim
nested-functions
next.js
nextjs
nextjs-markdown
nextjs-sitemap
nextjs-sitemaps
nice-shot
nice-shot-pro
notion
notion-api
notion-api-python
notion-budget
notion-budget-template
notion-budget-tracker
notion-bug-report-tracker
notion-dashboard
notion-expense-manager
notion-habits
notion-habits-dashboard
notion-habits-template
notion-habits-tracker
notion-habits-tracker-template
notion-issue-tracker
notion-mistake-tracker
notion-product
notion-product-dashboard
notion-product-roadmap
notion-product-roadmap-dashboard
notion-tasks
notion-tasks-dashboard
notion-tasks-template
notion-tasks-tracker
notion-template
notionworkspaces
openai
osx
pagination
personal-ifttt-framework
photospicker
photospickeritem
phpickerfilter
postgres
postman-capabilities
postman-request
pre-request-script
product-roadmap-notion-template
product-roadmap-template
productivity
programming
python
python-api
python-debugger-tutorial-for-vs-code
python-debugging-mode-in-vs-code
python-notion-api
python3
reading
real-time-communication
rehype
remark
request-data
running-debugger-in-visual-studio-code
running-django-app-in-debugging-mode
running-program-in-debugging-mode-in-vs-code
running-python-code-in-debugging-mode
safari
screenshot-app-for-ios
screenshot-app-ios
screenshot-ios
screenshot-tool-for-ios
set-current-timestamp
setting-up-debugger-in-vs-code-for-python
share-extension
sharelink
sharepreview
sharesheet
simple-websocket-server
sitemap
slice
slices
slider
sort
sorting
space-complexity
sql
ssh
step-by-step-guide
stocks-profits-tracker
stocks-profits-tracker-template
stocks-tracker
struct
sustained-vigilance
swift
swiftui
swiftui-button
swiftui-button-action
swiftui-button-style
table-of-contents
tasks-tracker-notion-template
tcp
test
testing
textfield-swiftui
til
tim-sort
time-complexity
timeliness
timestamp-integration
timsort
transferable
triggers-and-actions
tutorial
unittest
unix
us-stocks
usa-stocks
useful-ios-features
using-breakpoints-in-python-debugger
using-virtual-environment-with-python-debugger
vanilla-javascript
variable
vim
visual-mode
visual-studio-code
vs-code
vscode
vscode-go-to-line
walter-isaacson
web-sockets-in-go
websocket-client
websocket-programming
websocket-server
xcode
xss