Add external_link_new_tab param

master
Will Faught 2 years ago
parent 8381f5d96b
commit 7282c89d2b

@ -178,6 +178,7 @@ There is a single parameter object with sensible defaults that can be overridden
```toml ```toml
[paige] [paige]
color = "#0d6efd" # Bootstrap primary color and theme color for Safari and Windows color = "#0d6efd" # Bootstrap primary color and theme color for Safari and Windows
external_link_new_tab = false # Open external links in new tabs
math = false # Enable math typesetting math = false # Enable math typesetting
style = "" # CSS included at the end of the stylesheet, before style-last.css style = "" # CSS included at the end of the stylesheet, before style-last.css

@ -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>
Loading…
Cancel
Save