Fun With Hugo

It seems every time that the Muse inspires me to hammer out a blog post I spend most of my time caring for and feeding Dependabot or wrestling with ruby gems. In an effort ot reduce that maintenance cycle I took advantage of a PragProg Thanksgiving offer and purchased Brian P. Hogan’s very helpful Build Websites with Hugo.

I followed along with Brian’s example site and learned some neat things about the archetypes and creating themes which will be very handy when I get to work on my home-brewed beer site and need templates for the beer styles and recipes.

Initially this static site generator feels like things that I’ve used in the past -> jekyll’s scaffolding, Master Pages, and yes even the crazy “templated layouts” that we hacked together when the web was much younger.

Themes

One of the things that drew me to Hugo was the variety of themes that are already available. Since I already use Git for my day job, including themes by importing a git submodule and changing a few values in a config file was very appealing. This gave me the opportunity to very quickly try on other themes and get a feel for how difficult or easy they would be to work with when I felt the urge to put another post together.

I tweaked the “m10c” theme just a wee bit. To my eye, the colors in the left nav menu didn’t have enough contrast when I opted for the red/black styles, so I changed the “lightest-color” to be white. Next up will be some tweaking for that left nav menu to make it display the items in the order that I want them displayed and not alphabetically.

RSS Feed

Today I was trying to get the RSS feed to work in Hugo and be compatible with my existing URL scheme. This was not as intuitive and straight forward as I’d hoped. After a few mis-starts copying and pasting advice from around the internet, I found some documentation which pointed me to the “output” settings for the confiig.toml file. After updating my file to this:

[outputs]
home = [ "RSS", "HTML"]

[outputFormats]
[outputFormats.RSS]
mediatype = "application/rss"
baseName = "feed"

and including a link for the menu item

[[menu.main]]
identifier = "rss"
name = "RSS"
url = "feed.xml"

I had a navigation link for the rss feed and a feed.xml file listing all of my existing content. :-)

Then I got tricky and tried to see if I could add the RSS feed link as a “social” item. Surprise! That added the RSS icon to the sub-naviation and allowed me to link to the feed xml file.