Switching to Hugo

Jekyll, self hosting a hacked together templating server, or Hugo... the possibilities are endless.
Reading time: 2 minutes.

Jekyll, self hosting a hacked together templating server, or Hugo… the possibilities are endless.

Motivation

I’ve been wanting to switch to something other than my own templating system for a while now. However, I had a couple reasons for keeping the templating system:

  • “Absolute control” over everything
    • I won’t have to go digging for loopholes to get certain features I want working
  • Learning
  • Software independence
    • A bit ironic considering the previous project had way too many npm dependencies anyway

Things eventually got messy. I mean… I had code that looked like this :joy: :

const reqPaths: {[p: string]: string} = {
  "/": "about.html", 
  "/url": "url.html", 
  "/softsim": "softsim.html", 
  "/iou": "iou.html",
  "/truthy": "truthy.html",
  "/blog": "blog.html"
};

Object.keys(reqPaths).forEach(reqPath => {
  app.get(reqPath, (req: Request, res: Response, next: NextFunction) => {
    // it's not actually a blog, but I conveniently wrote this to treat this with arbitrary keys
    readBlog(path.join(process.cwd(), `public/views/pages/${reqPaths[reqPath]}`)).then((blog: Blog) => {
      blog.url = "https://andw.me"+req.url;

      res.render("index", {
        blog: blog
      });
    }).catch((err: Error) => {
      console.log(err);
      // 404 them lol
      next();
    });
  });
});

Futhermore, I noticed that there was egress limit on Google Cloud Platform’s free tier, and although I haven’t crossed the limit yet (and that CloudFlare does an amazing job with regionalized caching), I wanted to make sure that I wasn’t getting charged for serving too much data.

The solution was to switch to a static site that is hosted generously by a reliable provider: Github Pages.

A website from scratch?

Pfft… no way!

The main reason I used a markdown-to-html generator in the first place was to avoid writing HTML. I am by no means a proper frontend designer, so markdown is a solid first choice to write blogs.

I didn’t want to deal with any backend code or want to go through the trouble of hosting for anything dynamic.

I started with Jekyll, a static site generator. Jekyll comes to mind when most people think of static web generators built around markdown.

Jekyll

The reason why I didn’t stick with Jekyll is because I didn’t like the look of any of the themes.

I found an “awesome list” of Jekyll themes but even then, there still wasn’t one that stood out. Minimal Mistakes is a good theme, but I couldn’t get it to work.

The Jekyll themes that looked “good” had to be bought from the jekyllthemes site.

I will definitely be using Jekyll for my other projects though.

Hugo

I looked over a couple of other people’s blogs to see what Jekyll themes they were using. I ran into a Jekyll alternative instead: Hugo. Hugo came with many more themes that I could use.

I picked Dream by gleny0ung to use because I liked the cell-like blog previews on the home page.

Moving forward

My old website can still be accessed at old.andw.me. (update from 2024: link now broken)

I still need to figure out and where I’m going to place my old tools like truthy and the URL shortener. (update from 2024: link now broken)

Last modified 2021.11.20