I gave #Eleventy (the static-site generator) a go, suggested by some fine folks from 32bit.cafe, particularly inspired by @Leilukin's site.
it went pretty well and could even handle my bi-hosting for markdown -> html for my website and gemtext -> gemtext for my gemini capsule surprisingly smoothly.
...until I needed to handle per-blog-post assets.
I put assets such as images associated with each post in the same folder as the index.md
of the post resides: posts/2025-01-01-my-post/index.md
and posts/2025-01-01-my-post/my-image.png
. this is not only easier for organization, but also referencing assets and avoids duplicating post slugs in the file hierarchy.
In #Hugo, these assets will get the same permalink as that of the post. ie, /posts/my-post/index.html
and /posts/my-post/my-asset.png
, where /posts/my-post
is the configurable permalink for blog posts.
Eleventy doesn't handle any file extension other than what can be made into pages, from (md, html, njk, etc) and so these assets are ignored by default. With eleventConfig.addPassthroughCopy(...)
I can use a glob such as posts/*/*.{png,mp4,webp,...}
to copy the assets into the posts/*/
directory for output. However, it does not respect the permalink
field in the data cascade at all, and ends up reproducing the full source directory slug together with the ISO date prefix, ie: /posts/2025-01-01-my-post/my-image.png
.
The PR that resolves this which adds a new mode: "html-relative"
option to addPassthroughCopy
was merged about 3 weeks ago(!), and only part of the latest alpha release as of writing.
At a glance, this seems to solve my problem, but only partially -- it might not work when a post has no HTML output, only gemini, with a single index.gmi
file in the posts/2025-01-01-my-post/
directory.
Fingerprinting and cache busting for resources also seems to require using a post-site-generation hook. one of the solutions would loop through all copied assets, rename the files (eg, asset.ext
-> asset.hash.ext
), loop through all output files and rewrite references to each asset.
Don't get me wrong -- Eleventy, Hugo, Lume, and all the rest of them, they're all great at doing what they are able to do. But when popular SSGs try and fit every need they still end up becoming a little opinionated in certain corner cases. My attempts to roll my own ends up being not very well tested clones of existing SSGs. Perhaps if I'd started with something different, such as Eleventy rather than Hugo to begin with, the story would be different. Or am I just doing everything wrong?
In any case, looks like Eleventy won't be the end to my SSG-hopping...