Hugo, the Static Site Generator

So, years ago, Morten, provided me with a makefile and som m4 macros stuff and I played around with that for generating the pages for this blog back in the day. Then I switched back and forth between engines, and settled on wordpress for the last many years. But now Morten mentioned Hugo. I get the feeling that one of his hobbies is changing his blog-engine ;) That being said, who am I to talk?

Migrating from Wordpress

So to get started I researched how to migrate my posts out of the wordpress that it lived in:

Turns out my wordpress was a snowflake, but yay GitHub - I could just fix it

That was enough PHP to last me years!

After I ran that plugin I got a zip file with a lot of .md files:

├── about-2
│   └── index.md
├── post
│   ├── 2005-07-31-postfix-setup.md
│   ├── 2005-08-08-bookmarking.md
│   ├── 2005-08-11-latex-tricks.md
...

Using Hugo

Tinkerer as I am I never looked much at the file and the documentation of hugo. I just dpkg -i hugo_0.15_amd64.deb and tried hugo from an extract of the zip. Turns out there is more to it than that.

Reading the quite good documentation I settled on “just” using hugo new site blog.vrist.dk. With that I got an empty scaffold up and reading the docuementation further I figured that all those directories and .md should actually just have been extracted under the content directory.

Then the time came to see the results. Just using hugo server doesn’t really yield much.

When you will go to the link, you will see nothing. There are couple of reasons for that

Hugo Quickstart Guide

Turns out you need to (quite reasonably so when you think about it) either yourself specify how to render the Markdown or use a theme

Browsing around I stumbled over hugo-uno and went with that as a beginning.

The final touches

Not everythiny was quite ok, so I had to change static urls that pointed to images not imported, I’ve added a tags.html partial and so on, but all in all it was quite painfree.

The most notable done was writing shortcodes for the “gallery” like functionality I did at my wordpress setup. It took some research - I guess my brain works in strange ways compared to the way shortcodes was thought.

For example:

Conclusion

With all this niceness I might even write something every now and then.


Comments