Creating a Github page using Go Templates and Github Actions

Weds Apr 9 2025 11:51pm, updated mon Apr 14 5:10pm

After 12 or so years, I decided to start working on a personal site again. I was inspired by the the AI ghibli animation pictures that are suddenly so trendy. I took design inspiration from other low key personal pages i've seen on Hacker News.

Getting reacquainted with github pages, I quickly found myself wanting for a bit more power than static HTML could provide. The default option provided is Jekyll. While i'm sure it works fine, a ball of Ruby written by the former CEO of Github over a decade ago seems like a toolchain I don't want to come to grips with. Hugo could also work, but it seemed like overkill. I just wanted dead simple templates and a couple of them. Making a Next.js site also seemed like a drag. An empty next.js project is 30mb. Seems bloated for what I'm trying to accomplish.

After a bit of research, I got the idea to write my own static site generator in Go. Go templates are pretty simple and relatively primative but could get the job done for a static page like a blog. While powerful, they lack the creature comforts of what one would expect with tooling like React.

They say good artists copy, and great artists steal. I wonder if it applies to coders. While kinda cliche, I was able to borrow inspiration from some other prevalent web technologies. I like the next.js pages routing. It harkens back to the good old days of web. Simple and easy to grok. The assets folder that rails has is also simple enough to understand. I can rock with that.

At first I just wanted a blog, but eventually I wanted it to work in a gitOps sort of way. I leveraged github actions to SSG the static pages at build time, then load the bundle up. Lucky for me, most of these actions already exist, so I just had to write a touch of code to generate the static pages.

The Good

This has some nice side effects. Pages just work. it's great. No JS. No react. no context or state, just writing.

The project has zero dependencies outside of the go standard library. I use makefiles because i'm a luddite, but not required by any means.

I got pretty far with virtually no CSS. While it is probably not that accessible, as I write more, I can concoct the minimal amount of styles.

You want draft posts? It's called a branch; merge to the main and it gets released.

The Bad (slash things to solve later)

this serves as a list of known flaws (it's a quick and dirty product) slash informal to-do list for myself.

Local dev workflow is kinda jank. There is no "hot reload" yet (although I could probably whip this up pretty quickly). It currently consists of opening the page in the browser. Would be nice to re-run the static folder build step on changes in the pages directory.

I don't think i've completely solved image rewriting / correct relative asset paths yet. I should probably test with a proper local static file server. update: I have added a local file server. [link]

It would be nice to embed some metadata in each page template with things like title, article name, updated at etc to populate SEO things like meta descriptions and to keep it DRY.

Conclusion

Overall, this was a pretty simple project and didn't take me long to do, but I think it's important to realize how much we sometimes over complicate simple things and end up using a clunky ass tool because it's "easier".

You can view the source code here if you're so inclined: github. It's open source for now because ain't no way in hell i'm paying github no damn $4/mo for a private repo.