How To Tell Hugo To Open Links In New Tab
Took too long to fix this one. To open links in new tabs using Hugo’s Goldmark renderer, do the following:
- Create this file
layouts/_default/_markup/render-link.html
- Add this in the file:
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>
{{ .Text }}
</a>
And you’re done.