Adding nofollow in render-link.html

I tried to add nofollow into any page which enables nofollow in front matter,
in my layout/_markup/render-link.html:

{{ if .Page.Params.nofollow }}
{{ if in (.Destination) “mydomain.com” }}
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination “http” }} target="_blank" rel=“noopener”{{ end }}>{{ .Text | safeHTML }} - test 1
{{ else }}
<a href="{{ .Destination | safeURL }}"{{ with .Title}} rel=“nofollow noopener” title="{{ . }}"{{ end }}
{{ if strings.HasPrefix .Destination “http” }} target="_blank" rel=“noopener nofollow”{{ end }}>{{ .Text | safeHTML }} - test 2
{{ end }}
{{ else }}
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination “http” }} target="_blank" rel=“noopener”{{ end }}>{{ .Text | safeHTML }} -3 test 3
{{ end }}

I can see my external link was perfectly rendered when using “View-source” as:

<a href=“https://www.other-domain.com/” target="_blank" rel=“noopener nofollow”>Test - test 2

but, NO nofollow if using chrome “inspect”,

<a href=“https://www.other-domain.com/” target="_blank" rel=“noopener”>Test - test 2

I believe the “nofollow” is not active(is it?) even it’s rendered.
Any Javascript may cause that issue?

BTW, I am using hugo-clarity theme

replace (U+201C) and (U+201D) with basic quotation mark " (U+0022)

Thanks for your reply, I think the quotation was just this forum format, I was using basic quotation in my server.
But I did try to make the change from double quote to single quote.

link in the View-source page:

<a href=“https://www.other-domain.com” target="_blank" rel=‘noopenner nofollow’ >Test - test 2

that link under Chrome F12 Inspect:

<a href=“https://www.other-domain.com” target="_blank" rel=“noopenner”>Test - test 2

Not only the nofollow was gone, the quotations were modified to double quotation!

I have found the answer:
all the nofollow links were modified by a theme javascript:
themes/hugo-clarity/asset/js/index.js,
function: makeExternalLink()

disable it, my “nofollow” links are working like a charm.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.