Skip to main content
  1. Documentation/

Hugo

1 min

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>

Bron