Just writing a quick thing to say this blog is generated with a tool called Hugo. It takes a bunch of Markdown files and generates some static HTML files, one per post, plus some extra files for scaffolding (e.g. landing page, list of tags, etc).
There are also a bunch of metadata that can be specified (via a yaml blob at
the top of each .md
file) which describe which tags apply to a post, the
creation time, short description, etc. For example, this page’s metadata is:
---
title: "Hugo"
description: |
Small description of Hugo static site generator.
author: Aimee
date: 2024-07-19T15:09:50-04:00
tags:
- devlog
- intro
mood: []
toc: false
draft: true
---
Just writing a quick thing to say this blog is generated with
...
If a post has the draft: true
property, then it is not, by default, generated
into a static file and thus is not publically available on the site. Generally,
I run hugo server -D --renderToMemory
locally when writing a new post to (a)
render drafts (-D
flag), and (b) to output to memory only (--renderToMemory
flag) so as to not pollute the output directory.
When I’m ready to publish, I remove the draft: true
property and run hugo --minify
to generate minified static HTML pages in the output directory. I
then commit the newly generated files to Git.
Deploying
Deploying to my actual webserver is done via some Git magic. After Hugo generates files, those are committed to a Git repo. On the actual blog webserver (a k8s nginx service) there is a helper process that polls/fetches updates from the Git repo.
So, nginx serves the static files from the most recent commit to Git. The repo is checked on a regular basis for updates. Since the site is just static files, nothing needs to compile on the server-side and no processes/binaries need to restart. It just serves whatever is checked out onto the local disk.