Goodbye Astro, hello Zola
Posted on . Updated on .
I just converted my personal website which used Astro to a digital garden powered by Zola.
I’ve been using Astro in the past couple of years and it worked quite well. I like Astro file syntax, which is JSX-based but has more sugars. As a static site generator, Astro was a fresh and enjoyable tool to use. But honestly trying to catch up with all new features in every Astro versions is tiring. After all this personal site is dead simple and I probbably don’t need to pull MBs of JavaScript that does some stellar and useless stuff like supporting LLMs, flying a devtoolbar, or validating content’s schema.
Updated: When I think about building website for a flower shop or e-commerce products, probably Astro is helpful since it can fetch data from different sources. Still for working with Markdown files only, it feels bloated.
Enter Zola
Zola is built in Rust, weights about 12MB in one single binary file.
Other good things about Zola can be found in its website, here I only list here some bummers on the way:
- Markdown files always require frontmatter. There is that list of predefined metadata and Zola will happily shout at you if your old Markdown has something extra out of that list. I think the intention is good, but will take some effort for bigger sites to fix their files.
- Newly-generated project doesn’t include any template. I think a default one could help to have the general picture about how template files are organized and Tera syntaxes.
- The docs is hard to navigate. I cannot pin-point the exact issues here but I saw myself going back and forth between pages, just because “I remember I see it before but in which page?”
Still it took me one evening to have the whole site running in Zola and I think it’s a fair.
Shortcodes
Zola supporting shortcodes could be a game changer. It allows us to extend Markdown syntax and render, for example, web components in the output.
Deployment
As I’m moving my stuff out of Github, autodeployment on Netlify is no longer possible because Codeberg isn’t a supported git server. But hey, I don’t need to spin up a VM every time I want to deploy HTML files, right?
It’s nice that Zola also includes a guide to manually deploy to Netlify. I made a fish script to automate all the things.
set ACCESS_TOKEN 'xxx'
set SITE_ID 'xxx'
set TITLE $(git log -1 --format=reference | string replace -ra ' ' '+')
zola build
zip dist.zip public/**
curl --progress-bar -H "Content-Type: application/zip" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data-binary "@dist.zip" \
"https://api.netlify.com/api/v1/sites/$SITE_ID/deploys?title=$TITLE" | cat
echo \n\n
rm dist.zip
git checkout public
Just one fish deploy.fish away and my site is updated. Actually it’s even faster than automatic deploy.
End
So far I’m happy with the setup. Maybe at some point I will make Ehkoo a Zola garden too, but probably not in a near future.