tlog static site generator
for some time now this blog was generated using hugo. not anymore! i've built my own generator, tlog. in tcl.
the quest for a sane tool
hugo seemed nice initially, but after some time it has shown that it is too baroque and changing more often than i like. i'm not a fan of either to keep an old version around or frequently fixing my contents to have them build again.
there is no shortage of static site generators, most of them having more functionality than i require. after all, for a simple site templating is enough.
yes. turns out that tcl is rather nice, and i'd argue, stems from the same mindset go does. only that it hasn't seen that much public attention in the last decade. it has a really nice feel to it, the base language is rather small and things are orthogonal (like go). that tcl has good man pages is a pleasure in current times. 3rd-party packages and documentation show their age though, there are many things which aren't maintained anymore. maybe i'll start a list of things i found useful to spare other souls hours in the tcl wiki :)
what makes it a good candidate for a site generator is that templating
is easy: just use
from the manual:
This command performs variable substitutions, command substitutions, and backslash substitutions on its string argument and returns the fully-substituted result. The substitutions are performed in exactly the same way as for Tcl commands.
not the thing you'd use if connected to the net
(there is sandboxing with
but perfect for generating static files :)
the result of my experimentation is tlog. i'm rather pleased with it so far. there are some warts if you look at the code though :) it does as little as possible, and just grabs contents from a directory and puts them into a template:
tlog.tcl -t template/template.html content/mypage > output/mypage/mypage.html
that one page is stored as whole directory is a departure from other static site generators i've used. usually contents for a page are stored as single (markdown) file. that meant that metadata has to be stored as "frontmatter" in said file. i've always felt that this is a bad hack. tlog uses additional files in the content directory for things like article date, etc. those contents can also be tcl scripts, so everything remains fully scriptable :)
every other functionality, say a blog index, can be scripted around this base tool. if you want to look at how that might be done, take a look at the repository for my blog