Having had my old blogger site since 2010 with no posts since 2016, it felt like the right time to start trying to blog more and to move to a more modern statically generated site. This would enable me to just write markdown without the hassle of then getting that into blogger. I could then apply CI/CD to have the site automatically build with updates. In this instance, since I’m also attempting to learn Go, I chose Hugo.
There are many platforms to choose from when it comes to creating a new site, even when only looking at Static Site Generators. Statically generated sites are great since they offer improved performance, better security and in general are less effort to maintain.
When I started looking, I also considered Gatsby since I’m also keen to improve my React and GraphQL skills too. I’m already using React elsewhere, including in a NEXT.js site we’re using internally for digital signage, so in the end I went for Hugo.
That was until we migrated to Gitlab for our repositories and I discovered Gitlab had a template for adding a Hugo site to Gitlab pages. It wasn’t exactly what I wanted, but it would let me get set up much faster and allow me to play with it over time.
To create the gitlab pages site, you just add a new project, select the “Create from template” tab and choose the “Pages/Hugo” template by clicking the “Use template” button.
Once you’ve selected the template, you need to give it a name of username.gitlab.io in order for it to be used as the toplevel site for your user account. There is more detail along with some examples on the gitlab site.
After that, it’s simply a case editing the
config.toml file and updating the baseurl to reflect the new site, for example in my case:
baseurl = "https://darrenparkinson.gitlab.io/"
You can find this address by going into “Settings -> Pages” on the repository
I then spent some time writing a couple of articles to get it going and modifying the
config.toml file some more to get the navigation and organisation I wanted. I’m happy to write some follow up articles if anyone is interested.
Some tasks left to do include:
- Adding disqus to enable comments
- Adding a custom domain
- Adding TLS
I’m sure there will be plenty more, but that’ll do for now.