Updated RSS Feed
Reading time: 2 minutes (341 words)Author: @pugmiester
Tags: blog , rss
Since I built my web server to host my blog, I’ve been using it mainly as just a blog with dated posts as I add content but I wanted to also give myself the opportunity to create some other content that doesn’t really fit the blog style.
I created a now page but I have a few other ideas I’d like to play with but the default setup of Hugo builds an RSS feed for every page and post across the site. That’s not something I really wanted so I put it on the back burner for a while.
Today was the day to get that figured out as I have a new page idea I wanted to add but not necessarily broadcast to the world.
So, I needed to find a way to update Hugo so that it only created the RSS feed from my posts and not from my pages. I did some searching and came across this forum post that walked me through the process. I’m no coding expert so I wasn’t sure if I would be able to actually get it working (my track record with internet examples is not great) but it looks like on my first attempt I got it working.
OK, cool, except, what about everyone who might have already subscribed to my RSS feed (all 6 of them, probably as I have no stats) with the old URL?
I have a plan, and hopefully it’ll work and not break things. OpenBSD’s httpd server, on which my website lives, includes a rewrite directive you can add to the config so I’ve just been testing it and I think it’s working using the config below.
location match "/index.xml" {
request rewrite "/posts/index.xml"
}
I’ve so far only tested this by trying to download the xml file from the original link and it seems to feed me with the updated “posts only” version from the posts directory but I guess I’ll have to wait and see if that same process works for real with RSS clients.