Building static websites with Zola and Rust
2019-01-16
Rebuilding my website as a static website with Zola
I've been unhappy with my website for a while now, but, as it goes, I just didn't have the time to sit down and put in the effort to rewrite everything from scratch. At one point, I toyed with doing a WordPress or Laravel-based site, but in the end, time constraints once again made this impossible.
After jumping into Rust a while ago, I chanced upon Zola, a static website generator built in Rust. This of course got me thinking and I sat down to see what it was all about. Without getting into too much detail, the result is this website! I managed to do in a couple of days what I've not been able to schedule for years now.
Zola ticks a few boxes for me:
- It is fast and easy to use.
- Great documentation and examples.
- Single binary to install, no dependencies so it can work in a CI/CD environment.
- Built in Rust!
So what happened
Markdown happened. Zola happened. Templates happened. See, the appeal of something like a CMS is that it makes it easy to add, remove or update content on a website. You can quickly change themes, add features etc. The downside is of course that all of that comes at some kind of a cost. Often, you have bulky libraries or frameworks or server requirements. The generated HTML is not always simple to debug and having things like databases etc. exposes a larger attack surface to potential attackers.
With a static site, you get some of the benefits of a CMS, not all, but also very few of the negatives. In general, a static website can be served from a smaller hosting account, would, in theory be a bit more secure and, if needed, should be easier to scale to higher traffic volumes.
The journey to here
It's not been entirely smooth sailing, let me tell you that. Not because of Zola, but rather because of my lack of some CSS and HTML skills. I've never been a serious front-end developer, since most of my UI's were built for Android or iOS and the web was a distant, often forgotten cousin. Now though, I've had to step up and solve some interesting challenges to make my site work the way I wanted to.
Thanks to the Zola documentation, which is superb, I've been making good progress on the site. I'll be back to update this entry, once I've figured out a few more things.
Return to the blog index