Hugo + Forestry + Gitlab = <3
This blog uses a so called “static site generator” (SSG).
In this post I will show you which tools I use to overcome the bad things about SSGs and how I use them.
In case you don’t know what these are: In short, it’s a piece of software that takes a bunch of text file as input and generates HTML files. In the process things like menus, sitemap, breadcrumbs etc. are generated.
You may ask yourself: Why? Well, the only dynamic functionality on this blog is the comment section which is hosted somewhere else.
Since the vast majority of this blog does not need to be generated dnymically, a system like serendipity or wordpress would only lead to potential security holes without any reason for taking the risk.
The simple way
The benefit of SSGs is: You edit some markdown files, the HTML files are generated and you’re done. Well, if your only goal was to generate some local HTML files, but if you want to create an online site or blog, that HTML needs to go somewhere.
But as soon as you are on a different computer, have multiple content authors or just are a fan of your work not getting lost in the next HDD crash, you want to have something different.
The simple enough way
So to step up your game, you use a version control system. Nowadays you will most likely choose git. In my case I’ve choosen gitlab, mostly because there are private repos and not everyone is able to see my drafts.
So now you have a git to backup, but to make things perfect you surely would want to publish your site as soon as you are merging something into the master branch - right?
So this is where netlify comes into play. It’s a free* hosting service with auto-deploy from gitlab (and other services). You create an account, do some setup stuff and your content is available online almost immediatly.
Do you remember that I wrote SSGs need to be run to generate the HTML? Well, netlify does that for you. And if you want to, you can use your custom domain, like I am using 3stadt.com for this blog.**
If you dig deep enough, there is the gitlab Web IDE. With that IDE, you are able to edit your site on the go in your web browser. But well, it’s not the prettiest thing if you’re just editing content.
The simple and beautiful way
So as last part after hugo, gitlab and netlify, there is forestry. To be fair, there are still some things missing, like the custom hugo templates shown in the next screenshot.
But what you’ll notice as well: It’s a nice, beautiful editor. And well, it’s as free* as netlify.
Tying it all together
After all, the workflow is like this:
- Log into forestry
- Create a new entry
All the “heavy loading” is in the background. Well, in my case forestry is not committing to the master, so I need to create a PR and stuff, but that’s just because of me.
If there is interest in some actual tutorials on how to click through the services and set everything up just let me know in the comment section. :-)
*(free: There are paid pro features)
**Caution: You need to use the netlify DNS Servers for your domain.