(Disclaimer: I’m new to hugo!)
I recently discovered the built-in figure shortcode.
I’m wondering why it uses an h4 tag for the caption? It’s not a header and it makes styling a bit more of a hassle.
Is there a way to tell it not to add it?
Welcome to the forums @asm.
To answer your question, you can override the builtin figure shortcode with your own version. Here’s how:
- Copy the code from the builtin figure shortcode here
- Create a file at
your-site/layouts/shortcodes/figure.html then paste in that code
- Tweak the shortcode as desired, e.g. replace the
<h4> tags on line 16 with something else
Thanks! That helps a lot.
I see from that code that if I use “caption” instead of “title” I get a <p> instead of an <h4>.
Slightly better, but I don’t know why it feels the need to add anything…