Fixing RSS In Hugo
If you’ve been following along, you’ll know that I’ve become a bit obsessed with this blog. I haven’t had this much fun since I switched to Linux in 2017. From the writing to learning new things about Hugo, it has been a blast.
First I added comments, then I added comment counts. That was fun. These last couple of days I’ve been messing around with file structure (Hugo calls it taxonomy), and the RSS feed. I’m actually writing this post to test out my RSS feed changes as well as test some additions to the script I talked about the other day.
Full Sized RSS⌗
Before, all that you’d get if you subscribed to the RSS feed was a small snippet of the post. I hated that. I love RSS and I don’t give a damn if you visit my site to read my stuff. I don’t make money here, and I want this to be as accessible to everyone as possible. So, I did some research and found that it was pretty easy to change this behavior in Hugo.
-
Go to your layouts folder in the theme you use. Then find the
_default
directory, and then therss.xml
file. If this doesn’t exist, you can create it and find the default syntax on Hugo’s website. -
Inside there, you’ll want to find the spot that looks like:
<description>{{ .Summary | html }}</description>
<content>{{ .Content | html }}</content>
-
Change the
<description>
line to:<description>{{ .Content | html }}</description>
Then just commit the changes to your submodule and your main hugo site.
It will take a bit for that change to take effect. I’ve seen some people change html
to safehtml
or something like that, but I’m unsure what that does, so I did not make the change.
Changes to my script⌗
I now put all creations for my blog post creator script into a drafts folder. I’ve also added draft = true
to the front matter. Then I added in a time stamp in addition to the date stamp so that if I publish two posts a day, they show up in the right spot. I’m testing to make sure this works by publishing this post. If it doesn’t I’ll edit and let you know.
Edit, it didn’t work. Back to the drawing board
Here’s the full script as it sits right now:
#!/bin/bash
# The purpose of this script is to create a blog post template, save it where it needs to go, and enter vim with the cursor in the correct place.
# Written by Matthew Weber
# Created on 6/25/2025
# Version 1.1
#
# Check if a filename argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 <filename>"
exit 1
fi
# Get the current year
CURRENT_YEAR=$(date +%Y)
# Get the current datetime in ISO-8601 / RFC-3339 format
CURRENT_DATETIME=$(date +'%Y-%m-%dT%H:%M:%S%:z')
# Define the base directory
BASE_DIR="$HOME/mhome/Documents/Pages/hugo/mtwb/content/posts"
# Construct the full path to the year/drafts directory
YEAR_DIR="$BASE_DIR/$CURRENT_YEAR"
DRAFTS_DIR="$YEAR_DIR/drafts"
# Get the desired filename from the first argument
RAW_FILENAME="$1"
# Convert filename to a human-readable title (e.g., "my-new-post" → "My New Post")
TITLE=$(echo "$RAW_FILENAME" | sed 's/[_-]/ /g' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2));}1')
# Add the .md extension for the file itself
FILENAME="$RAW_FILENAME.md"
# Construct the full path to the new markdown file
FULL_PATH="$DRAFTS_DIR/$FILENAME"
# Create the year + drafts directories if they don't exist
mkdir -p "$DRAFTS_DIR"
# Check if the markdown file already exists
if [ -f "$FULL_PATH" ]; then
echo "File already exists: $FULL_PATH"
echo "Opening existing file in nvim."
else
# Write the front matter to the new markdown file via here-doc
cat > "$FULL_PATH" <<EOF
+++
title = "$TITLE"
date = "$CURRENT_DATETIME"
description = ""
draft = true
tags = [""]
rssFullText = true
[params]
author = "Matt"
+++
EOF
echo "Markdown file created successfully with front matter at: $FULL_PATH"
fi
# Open the file in nvim
nvim "$FULL_PATH"
I cleaned up the front matter line. There are still some spots that I can clean up, but it has been working a charm. I’m also working on a script that I can run after I’m done writing that will change the drafts line to false, move the markdown file to the right year directory, and then push the changes up to GitLab. This has been entirely too much fun. And has kept me from making Linux content lately. So I need to go edit a video.
Thoughts? Leave a comment below, or you can find me on the Fediverse or email me.