Heavily inspired by this example, my blog uses a shell script + pandoc as a homemade static site generator.
This repo is centred around the blg
script, which performs a tree map, converting all *.md files in src/ to *.html files in build/. Example usage:
blg --build # Build website to build/
blg --serve # Serve build/ on localhost
blg --clean # rm -rf build/
blg --help # show help message
We also include a helper script lsblg
which finds all blog posts, extracts metadata, and formats in markdown style. This should be used to generate the blog index:
lsblg > src/blog/index.md
To build the blog and ensure that the index is up to date:
./scripts/lsblg > src/blog/index.md && ./scripts/blg -b
There is one final helper script wcpp
which pretty prints a word count and reading time summary for each post.
- Create the markdown file in
src/blog/new_post_short_name/index.md
- Add the following metadata to the markdown file:
---
title: post title
subtitle: descriptive or witty subtitle
date: yyyy/mm/dd
word_count: X words ~Y minute read
---
- Write the post
- Find the word count and reading time with
./scripts/wcpp
- Run
./scripts/lsblg > src/blog/index.md
to update list of posts - Build blog with
./scripts/blg -b
- View changes locally with
./scripts/blg -s
Upload a .zip
version of the build/
directory as a GitHub release. There is an actions workflow that will automatically publish this.