Getting started with the Hugo static site generator

This blog is being powered by a static content generator called Hugo and hosted on GitHub Pages. Getting Hugo up and running was relatively easy. Download the relevant version and installation was just copying it to a folder.

Once installed, create a new site:

hugo new site mySite

In the site folder edit the config.toml file to change the baseUrl, the language and the title.

Use git to clone a theme from the available themes to a folder under the themes folder in your site.

A page can be added by typing:

hugo new post/somepost.md

and then editing the file generated under the content/post folder. You might want to remove the “draft” line".

To test the site, run:

hugo server -t thethemename

where the thethemename is the name of the theme folder and then go to the url given in the console output.

To build the static content:

hugo -t thethemename --destination=/somefolder

where somefolder is the name of the folder to build the content to.

This can then be pushed to GitHub.

Side note: You might also want to “git config core.safecrlf false” on the github folder to remove some CRLF warnings when pushing on Windows.

Links

Hugo

Available themes

Random Posts

Lazy programmers can be the most productive

There is often a work culture that you should be busy all the time - if you are a programmer you should always be typing and producing code. Programming is a mental process and so requires thinking. Sometimes a little thought upfront saves a lot of pain and work down the line.


Read More

New ways to generate ideas online

There are a lot of sites that claim to be idea generators. Most of them turn out to be just a button you click that slings together a bunch of random words that are meant to then become a prompt to generate ideas.


Read More

Zero to One by Peter Thiel

I had read a lot of good things about this book and it had sat on my Kindle for a long time. Really enjoyed the first half of the book but thought the second half was more focused on things that weren’t relevant to me. There were some statements made that were clearly opinions but were stated as facts. Overall a bit disappointing.


Read More