Is it possible to customize code block with language title?

Hi all!

I just started using Zola today after being a bit frustrated with Hugo. I’m wondering if we could somehow customize the code block further, like giving it a title according to the language that is inside the pre tag? Like in the following image:


In Hugo, I could retrive a data-lang attribute but it doesn’t seem to be available in the syntax highlighting mechanism for Zola.

Would appreciate some help :slight_smile: Thanks!

Not yet. I think it would have to be done in the theme.

I’m actually writing my own theme. Does this have to do with the “syntax engine” of Zola being different from Hugo’s?

There will be a class with the language name in the next version ( but adding something like data-lang makes sense as well. I’ll add that now.


0.13 should be released soonish, just waiting for a few dependencies to publish new versions on


Merci Vincent! And thanks for commenting on my Rust subreddit post :slight_smile:

Isn’t the class unnecessary now?

The class is for CSS styling (even though you can do it with data as well). It is a bit redundant but I think there’s no harm in having both.

1 Like