MINIMAL STATIC SITE GENERATOR / WEBSITE
#######################################
This repository contains my personal weblog including my own static
site generator.
The static site generator uses m4, make, shell and awk. Everything is kept
POSIX-compliant. It can convert the website to a gemini capsule using h2g[0].
Add a new article:
- Pick one:
+ ./artadd short_name "short description"
+ make new NAME=short_name DESC="short description"
- edit 'short_name.mc'
- put images etc in 'assets'
- make
- cp assets/ feed.xml *.html /var/www/html
- or use 'make tar' to create an archive
Updating an article:
- Edit article and don't forget to update MODIFIED
(Vim users see below)
Working with a draft:
- Pick one:
+ cp article.mc.in drafts/short_name.mc
+ make draft NAME=short_name
- edit 'short_name.mc'
- put images etc in 'assets'
- leave short_name.mc laying around till it's finished
- Replace __TITLE__ in short_name.mc or provide "description" in the next step
- Pick one:
+ ./artimp drafts/short_name.mc ["description"]
+ make import drafts/short_name.mc ["description"]
- make
- cp assets/ feed.xml *.html /var/www/html
See stddef.m4 for macros and usage.
Vim users
---------
Put m4html.vim in ~/.vim/syntax.
Add the following autocmd to your .vimrc:
" '*/blog/' is the directory containing this README
" Update timestamps in blog articles
autocmd BufWritePre,FileWritePre */blog/*.mc ks|call LastMod()|'s
fun LastMod()
if line("$") > 5
let l = 5
else
let l = line("$")
endif
exe "1," .. l .. "g/MODIFIED/s/, `.*'/, `" .
\ strftime("%FT%TZ", strptime("%F%T", system('date -u "+%F%T"'))) . "'"
endfun
(The autocmd is an adjusted version of the one found in the vim help,
see ':h autocmd'.)
--
[0]: https://sr.ht/~rkta/h2g/