Eleventy
2021-04-02 blog static site generationI've been meaning to write some blog posts for EVER. The blocker had been what to write it in. The problem is that I quite liked Medium for a while, but then it got slow and annoying and I was always worried about losing my posts. As with all things "free" and "cloud", one is somewhat at the mercy of the service provider (which isn't unreasonable from their perspective); the master data is on their servers, the styling, performance, availability and everything else is all down to them. This is good in some ways, but it's also a pain - not to mention a risk if the service disappears.
On top of all that there's the matter of data ownership and format - I'm sure there's a way of getting posts out of Medium but I can't even be bothered to look. I want something which is mine. And which is open so that I can still edit and maintain in years to come. Wordpress seems to be the blogging standard, but everything is in a database - and while it might be open, and I could no doubt script something to get the data out, it's yet another thing to have to do. Also, it's an application, which means there's code, which means attack surface, vulnerabilities, and more risk. I wanted to write plain text, store it on a filesystem (no database) and publish.
This led me to investigating all the Static Site Generation tools around. I was immediately interested in Jekyll but I am irrationally disinterested in having to get Ruby running. Hugo also looks good but I have been doing a fair amount of nodejs development recently and I favoured something along those lines.
My next stop was nextjs and nuxtjs - they generate static "apps"; things which get rendered by javascript. I am by no means against this approach but I just didn't see the point in writing something in plain text but which then gets packaged into a big blob of javascript. There's no doubt ways around it, and there are many great use cases in favour of it (PWAs being just one) - but no, too complicated.
Then I found Eleventy. It took about 5 minutes to get started with the base log project. You create posts in Markdown with a bit of YAML at the top and it all just works.
git clone https://github.com/11ty/eleventy-base-blog.git my-blog-name
cd my-blog-name
npm install
npx eleventy --serve
All I did after that was delete the existing git repo, recreate it so it's baselined for me and make a few changes: adjust the css; configure site metadata, tweak a template or two.
The resulting output is simple, small, insanely fast, easily indexible and I can host it anywhere. I love Eleventy!
- Next: DIY Devices - introduction
- Previous: In promotion of plain text