Hi,
This isn’t a feature “request”, I’m just sharing what I’ve done since I imagine that other people might also find this useful.
Some context:
- I use Zola to run a few blogs, and all of them are version controlled. Typically I’ll make a commit every time I publish a post.
- For management on my side, I have a draft section called
unpublished.
- The workflow is mostly something like this: write post → move to main blog folder → serve and check that everything looks okay → commit → build → upload to my S3 bucket
For my own admin, I tag posts with the tag WIP and give them the date 0000-01-01 so that they render properly in zola serve
until they are deployed. However, I’m very forgetful and sometimes forget to remove these and checking those things is too labour intensive for my tastes. Therefore I’ve written a pre-commit hook to do some of this work for me. Currently, the hook will build the website and check for publish dates and forbidden tags. Cutting out the build part of the workflow above. I’m planning to also implement a post-commit hook to upload/deploy the rendered version, but that doesn’t have an ETA yet.
Likely questions:
- Point of this post: I wanted to share what I’ve made in case others would find it useful
-
How can I use it? install Rust and pre-commit then add a file called
.pre-commit-config.yaml
to your zola root folder with these contents:
repos:
- repo: https://gitlab.com/savente93/web-proof-reader
rev: v1.0
hooks:
- id: zola
- How do I configure it? Right now, you can’t. It’s very specific to my templates and workflow. It only checks HTML files at the moment and all the checks are hardcoded. However, if you code yourself you can fork it and make adjustments. If there is enough interest in this I’d be willing to put in some work to make it more configurable but don’t expect this too soon. I’m also open to accepting PRs.
- What does this have to do with Zola? Nothing directly, it’s what I use. The hook very deliberately doesn’t check or touch any markdown files or templates, only the rendered HTML, you could conceivably use it with any static site generator.
- repo? Sam Vente / Web Proof Reader · GitLab