Support for custom tags for static sites
Hi all,
Thanks so much for Clerk, it's a fantastic project and wonderful part of the Clojure ecosystem.
I use it currently to manage my Advent of Code solutions (inspired by your https://github.com/nextjournal/advent-of-clerk of course) and it would be nice if I could customise the opengraph embed to be customisable without having to do some alter-var-root hacks (similarly for things like custom CSS, which I have to do this)
If this is possible already then my bad and please yell at me to check the changelog more often 😄
Hi @elken,
Thanks for your kind words and so great to see how you're using Clerk.
You haven't missed anything regarding being able to customize this more easily. There's a bunch of things for which a way to globally modify Clerk's defaults is desirable.
I have a few ideas but would be interested if you have something in mind api-wise. Would you expect to customize this by changing a viewer or something else?
So to me the obvious thing that jumps out is metadata, that will let you customise it per-notebook, but some global default you'd define in the index.clj entrypoint equivalent page makes sense also.
For open graph metadata, this is indeed already possible since #243, as you can see in this example https://github.com/nextjournal/clerk/blob/b972be682e9faf947cd6264c72f6695146acea58/notebooks/open_graph.clj#L2-L17
Since you normally want this to be different per notebook/page I think ns metadata makes sense. For customizing the css includes, one would probably want something different since this needs to be the same for all pages (it's currently in the html head).
Oh wonderful!
There's also <title> as well, currently it looks like it just uses the first heading.
On the CSS, yeah I think it makes sense to be the same for all pages; but someone might want specific CSS/JS for specific notebooks.
Am I doing something wrong here? I tried in today's solution but it didn't generate any tags.
https://github.com/elken/aoc/blob/master/src/solutions/2025/day05.clj#L5-L8
@elken this was a regression in clerk, fixed with the commit above. Thanks for the report and your patience.
Thanks as always Martin! I'll update and test shortly