Static site building plain and simple
Because I only rarely blog, I need a site builder that's uncomplicated and stable more than superfast or feature packed. Having gone from custom Rails CMS to Jekyll to Hugo, I find too much functionality gets in the way of flow when I usually end up having to revisit how things work before I'm able to start a new post. In 2020, what are ultra minimalist alternatives worth checking out?
Apart from maybe Nanoc and since I'm about to migrate my server on to OpenBSD, I would gladly have settled with Roman Zolotarev's unbelievable SSG script but for the lack of templating options. However, what is really the science of static site generators other than converting from e.g. Markdown plus templating? Given that fully mature dedicated utilities already exist for both, could using an extra program be completely avoided?
Not to discount the original Markdown.pl or how the readily available PHP CLI prints out static HTML at no cost, but in this case I saw benefits composing with Redcarpet for speed and {{ mustache }} for being logicless and language agnostic. On macOS they're casually installable via RubyGems as well as extensible en route to crafting a groovy executable.
# Place inside of e.g. ~/.bash_profile to skip sudo when installing gems export GEM_HOME="$HOME/.gem" # Let $PATH know export PATH="$GEM_HOME/bin:$PATH" # Now these commands reside in `$GEM_HOME/bin` directly callable gem install mustache redcarpet
Assuming YAML sister files for each .md
input instead of embedded front matter meta data (e.g. title, description), the trick to combining the redcarpet
and mustache
commands is to take an intermediate step for storing raw HTML content to then be inserting into the desired layout: a proxy template is required.
The following may be easily passed on to find(1)
for executing on a list of directories or called separately for populating sitemap and feed XML,
# Sample data.yaml.mustache, `content` key is arbitrary, could be e.g. `body` content: '{{{.}}}'
<!-- Sample layout.mustache, `content` needs raw HTML --> <body>{{{content}}}</body>
Adding tidy
(1) to repair common markup issues and luckily indentation all in one,
\ redcarpet content.md | # Parse markdown mustache - data.yaml.mustache | # Save as unescaped HTML in proxy template mustache - layout.mustache | # Fill in page layout tidy
I put an example that also provides Rouge syntax highlighting in a gist as a proof of concept, but Motyl is more of a finished product in the same direction.