Intro
As a ritual for programmers, the first output of any program should be some form of hello world
.
For this website, outside of saying hello world!
, I want to do something different.
So I’ve decided to talk about How this website gets deployed outside of hello world!
.
Hugo & PaperMod
Hugo, written in golang, is one of the most popular static site generators. After many times trying different static site generators(Jekyll, Hexo, Hugo…), I think currently, I am pretty satisfied about the functionalities and simplicity provided by Hugo.
There are many minimal themes avaliable for Hugo, I used PaperMod, which provides various of feature(maybe too much) for this simple website/blog.
Mathjax @ PaperMod
For the use of mathjax(which processes latex for markdown), we need to add the following code to a partial that loads at page you want to use latex at(I added in footer).(This is taken from example on Hugo blog) However, this will affect the deployment based on the method you install PaperMod(I just directly install it with latest master branch zip), for some methods you may need to fork and patch the repo.
|
|
I found that adding mathjax.js is enough for me right now, but certainly other more complicated options existed.
Cloudfare Pages
I tried to deploy this website on cloudfare pages. So if you visit this website succesfully without any http errors, that means it worked.
Deploying on cloudfare pages is very simple, you just link to your git repo, and specify the branch, command and directory for your website genereators. Wola, It’s done!
For themes depending on newer version of Hugo, set enviroment variable
HUGO_VERSION=0.81.0+
, cloudfare default version is very old(0.54.0). This is a known issue.
Deploying on custom apex domain is slightly complicated, but it’s still pretty simple if you set your DNS server to cloudfare. Remember to add the page rules in cloudfare dashboard.
However, as cloudfare pages free plans gets build limit monthly, the best practice would be only to trigger your build when necessary, and have a seperate draft branch in your repo for drafting the content.