Hugo Open External Links in a New Tab
The default behaviour in Hugo is not open a new tab for external links. This little snippet does the trick using render hooks. It looks complicated unless you have a basic understanding of the go templating packages Create a new file layouts/_default/_markup/render-link.html and add the below. Thats it! <a href="{{- .Destination | safeURL -}}"{{ with .Title}} title="{{- . -}}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="nofollow noopener noreferrer" {{ end }}>{{- .Text | safeHTML -}}</a> References Hugo: open external links in a new tab