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