Kirby and Git

I use Kirby for this website, because it’s fast, efficient, and the community is super helpful. (Also I used to use ExpressionEngine, and no thank you, that’s too much.)

I’ve split up the site into two Git repos, one for the actual infrastructure and one for content. For a text-based site like this one, doesn’t save me many KBs, but for my photography site it slims the repos down a good bit.

Kirby’s flat-file, so you can upload files directly or through the user-facing Panel. I don’t have the Panel installed in production—one less exposed surface—so when I push to the content repo, I need to clear the cache.

I could do that by logging in to the Panel and saving any change, which would trigger the clear systematically. But, see above, no Panel.

If, in any Git repo, you navigate to .git/hooks, you’ll find a bunch of sample Git hooks with .sample extensions. post-merge.sample is the one you want to modify. It’s already got the header for shell execution, so you can add whatever regimen you want to execute at the end.

In my case, the only command is to rm -rf the cache directory. I provide an absolute path because I don’t want to accidentally destroy something useful.

And that’s it. When I git pull on my server, it brings down the new content, and then it deletes the cache.

Read next
Four good podcasts

Read previous
M1 MacBook Air

Strangers are friends I haven’t met yet. Drop me a line.