halogenica / beautifulhugo

Theme for the Hugo static website generator
Other
1.14k stars 601 forks source link

Fix figure shortcode with attrlink #438

Open kmorel opened 2 years ago

kmorel commented 2 years ago

There were a couple of problems when using the custom figure shortcode with the attrlink parameter. First, there was a scoping issue that caused the hugo templates to fail when attempting to get the attr parameter. Second, the css for the anchor tag placed the link in the wrong place.

This is similar to PR #435 except that it also fixes a secondary problem with the css for the generated anchor tag.

Closes #258

kmorel commented 2 years ago

Well, I thought I had the attrlinks working, but there is still an issue. This change allows the link to be applied and places the text in the right place of the caption, but I just realized that the link does not work. For reasons I don't understand, the link for the image seems to extend over the figcaption tag, so when you click the attribute link, you actually get the image link overlayed on top of it.

I don't really understand this behavior, and I don't know how to fix it.