Add external_link_new_tab param

This commit is contained in:
Will Faught
2023-09-15 22:04:50 -07:00
parent 8381f5d96b
commit 7282c89d2b
2 changed files with 7 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
{{ $external := false }}
{{ if (urls.Parse .Destination).IsAbs }}
{{ $external = not (strings.HasSuffix .Destination site.BaseURL) }}
{{ end }}
{{ $newtab := and $external site.Params.paige.external_link_new_tab }}
<a {{ with .Destination }} href="{{ . }}" {{ end }} {{ if $newtab }} target="_blank" {{ end }} {{ with .Title }} title="{{ . }}" {{ end }}>{{ .Text }}</a>