Merge pull request #121 from SanchithHegde/hooks-new-tab

layouts: Add markdown render hook to open links in new tab
This commit is contained in:
Jake Wiesler 2020-10-18 11:22:53 -04:00 committed by GitHub
commit 780787127c
1 changed files with 4 additions and 0 deletions

View File

@ -0,0 +1,4 @@
<a href="{{ .Destination | safeURL }}" {{ with .Title}} title="{{ . }}" {{ end }}
{{ if strings.HasPrefix .Destination "mailto" }} target="_blank" {{ end }}
{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noreferrer noopener" {{ end }}
>{{ .Text | safeHTML }}</a>