Url scheme doesn't work

Configured as shown above, if you inspect the rendered page you will see this:

<a href="#ZgotmplZ" target="_blank" rel="noopener noreferrer me" title="Xmpp">
...
</a>

See the “ZgotmplZ” bit? If you search the documentation for “ZgotmplZ” you will see a link to:
https://gohugo.io/functions/safeurl/

Without safeURL , only the URI schemes http: , https: and mailto: are considered safe by Go templates. If any other URI schemes (e.g., irc: and javascript: ) are detected, the whole URL will be replaced with #ZgotmplZ .

If you look at how the paperMod theme renders the social icons…

…you can see that the author doesn’t pass the URL through the safeURL function. Please raise an issue with the theme author.

In the interim, you can override that partial template with your own:

mkdir -p layouts/partials/templates
cp themes/hugo-PaperMod/layouts/partials/social_icons.html layouts/partials/
cp themes/hugo-PaperMod/layouts/partials/templates/schema_json.html layouts/partials/templates

Edit layouts/partials/social_icons.html, changing this:

href="{{ trim .url " " }}"

to this:

href="{{ trim .url " " | safeURL }}"

Edit layouts/partials/templates/schema_json.html, changing this:

{{ trim $e.url " " }}

to this:

{{ trim $e.url " " | safeURL }}
1 Like