clerk icon indicating copy to clipboard operation
clerk copied to clipboard

Support for custom tags for static sites

Open elken opened this issue 3 weeks ago • 5 comments

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 😄

elken avatar Dec 04 '25 10:12 elken

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?

mk avatar Dec 04 '25 11:12 mk

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.

elken avatar Dec 04 '25 11:12 elken

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).

mk avatar Dec 04 '25 12:12 mk

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.

elken avatar Dec 04 '25 12:12 elken

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 avatar Dec 05 '25 08:12 elken

@elken this was a regression in clerk, fixed with the commit above. Thanks for the report and your patience.

mk avatar Dec 19 '25 22:12 mk

Thanks as always Martin! I'll update and test shortly

elken avatar Dec 20 '25 08:12 elken