Deploying Hugo using GitLab pages
It is 2025 and it’s still super easy to deploy a blog using Hugo and GitLab pages.
In fact, the post you are reading right now is exactly that, deployed on my self-managed instance.
But Jae, weren’t you on another host beginning from last year?
Yes, last year I switched to Mataroa for the ease of mind the platform has.
The interface is very clean, has no bullshit whatsoever and is made and hosted in small web fashion.
Sadly, it has one caveat that was underlined once again by @miyuru@ipv6.social
on the Fediverse (ironically under my post about GitHub and its lack of IPv6): no IPv6.
This is why today I moved back my blog on something I used to have a long time ago, a GitLab pages site generated by Hugo.
Actually implementing it was as easy as I remembered:
- Create a new Hugo project
- Add the CI config file
- Move my domain’s CNAME
- Wait for Let’s Encrypt to do its work (funnily enough this was the longest part)
- Tada, all done
The Hugo setup itself is fairly easy, so is the CI file:
default:
image: ghcr.io/hugomods/hugo:ci-non-root
variables:
GIT_SUBMODULE_STRATEGY: recursive
test:
script:
- hugo
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
deploy-pages:
script:
- hugo
pages: true
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
environment: production
The main difference from years ago is that now, we have fully-featured (and maintained) Docker images for Hugo, the one being selected in this instance being ghcr.io/hugomods/hugo
, maintained by HugoMods.
So now, enjoy all the posts over IPv6 \o/