Moved from Pelican to Hugo

August 1, 2017
3 min. read

This post is part of the Hugo series.

I’ve used Python as my main programming language for a few years. When my Word Press was hacked and defaced yet again, I finally decided to rebuild my website with a static generator and host on GitHub. I leaned towards Pelican, due to the Python base that I thought I could modify if I needed. And I hoped that I could get it to work easily.

I did get everything converted over to .rst format and rendering. I didn’t really like the template that I was able to get working, but the site was back up. I even created new content. Then I switched my main computers and had trouble getting Pelican to work again. For some things, Windows Python is a pain. I was able to get it rendering for some new content ealry this year, but it really was not a great experience and render times continue to climb.

Over vacation, I looked at Go and Rust. These are often talked about like they are competing languages, but they really have mostly different domains. I think I would be more productive with Go, but it would not help me grow as a programmer. I also was a little annoyed that there were many blessed data types, that do things you are not allowed to do with the language. Rust has much less of this, as most of the language is implemented IN the language. However, it has an undeniably more difficult learning curve.

When looking at static generators in both languages, I found immature ones in Rust and a mature and polished hugo. This is written in Go, but it really doesn’t matter as it is installed with a compiled binary. And it renders fast.

It took me a few days to get up to speed in Hugo and with Go Templates. Then I converted my .rst files to .md files and changed the front matter. With it not being as flexible in url pathing, I was happy to see alias, which are easy redirects for content. I can point my old category paths to current date paths with no loss of search engine results.

There are still a few warts, like the crazy ton of empty lines when you process a template. This is apparently going away with Go 1.6 that will be used for compiling the next version.

Note: I later learned that the secret to eliminating all the rendering new lines is in the template coding. The changing of tags from {{ to {{- will eliminate the white space between the opening and closing tags. When I was looping through pages to build series, this was resulting in many spaces and newlines. That has been cleaned up and taken care of with the next generation of the site.

Part 1 of 4 in the Hugo series.

Implementing a Series in Hugo

comments powered by Disqus