hugo-mods/lazyimg

Figure & Figcaption

Closed this issue · 1 comments

Hello. As a result of this mod, the pictures are wrapped in the <picture> tag, it would be nice if the pictures were wrapped in the <figure> tag and at the same time so that you can specify the figcaption="text" setting in the shortcode

kdevo commented

Hi @leokolt,
you can easily try this out by adding your own renderer, e.g. based on lqip-webp.html.

More detailed explanation:

There is no need to fork the project for this to accomplish this. Instead, you could add a file like figure.html (with content based on e.g. lqip-webp.html) to your project's layouts/partials/renderer and then specify that you want to use your own custom renderer via:

{{< lazyimg img="awesome-image.jpeg" renderer="figure.html" >}}

Does that make sense to you?
If it works well, I might also consider adding it to the project (so feel free to open a PR if your test was successful).