Target Blank and Rel nofollow

Is there a simpler way to implement target="_blank" and rel="nofollow" into the markdown links?

Since Raw HTML is disabled by default from Hugo 0.60.0, I don’t want to use the option
unsafe= true option to get it to work.

I have found a way to get this to work using markup but I want to avoid using target="_blank" and rel=“nofollow” on links which are part of the base URL.

<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text }}</a>

I would appreciate if someone could point me in the right direction.

you can now use the markup templates - render-link.html

checkout my samles :wink:

Thank you Ju52, that is exactly what I needed.

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