How do a link to a bigger image and back to original location

Hello,
to go from an image to a bigger version or a blown op detail I do something awkward with a backanchor like

 <a id="ba-suministros-01" style="visibility:hidden;"></a>

 <a href="/imagenes-grandes/suministros-03"><img src="/images/datos/suministros-06.png" alt="image" align="left" style="max-width:100%;padding-top:10px;padding-bottom:10px;" /> </a>

and then in the bigger image use the backanchor to get back. That is cumbersome and not elegant, isn’t there a more shortcode type of way? This I need in a lot of pages. Thanks, stay safe.

It seems like you may have asked the same question a couple of months ago:
https://discourse.gohugo.io/t/show-larger-images-with-one-click/30578

Please advise.

You mean something like a lightbox?

I use fslightbox (the free version), however you could create your own JS script.

https://www.w3schools.com/howto/howto_js_lightbox.asp