Skip to content

Commit

Permalink
Merge pull request #121 from SanchithHegde/hooks-new-tab
Browse files Browse the repository at this point in the history
layouts: Add markdown render hook to open links in new tab
  • Loading branch information
jakewies authored Oct 18, 2020
2 parents f76ad38 + 2a41549 commit ac5c699
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions layouts/_default/_markup/render-link.html
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit ac5c699

Please sign in to comment.