I have issue with “copy-to-clipboard” links on headings. The links (with FA icon) appear only on pages without images. The moment I add an image to the content (as a markdown link), all the copy-to-clipboard links disappear.
I am using Hugo Learn template although I think the definition for the copy-to-clipboard links is made on Hugo side. I could not find related any definitions from the template.
Apologies, I had read all the files in the Hugo Learn theme (except the Javascript), but could not find a reference there. I am not that fluent with JS/CSS/HTML, just learning.
That’s the theme! Thanks for pointing me to the right direction!
@maiki I cannot express how thankful I am to you . I have spend hours and hours trying to debug this while still learning Hugo (my first ever static site generator).
The issue was in the JS file you pointed me at.
I checked browser JS debugger:
So ‘o’ is undefined and gets used. The fix was a two-liner.
var images = $("div#body-inner img").not(".inline");
// Wrap image inside a featherlight (to get a full size view in a popup)
images.wrap(function(){
var image =$(this);
var o = getUrlParameter(image[0].src);
if (typeof o !== "undefined") { // THE FIX
var f = o['featherlight'];
// IF featherlight is false, do not use feather light
if (f != 'false') {
if (!image.parent("a").length) {
return "<a href='" + image[0].src + "' data-featherlight='image'></a>";
}
} // THE FIX
}
});