Add external_link_new_tab param
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
6
layouts/_default/_markup/render-link.html
Normal file
6
layouts/_default/_markup/render-link.html
Normal 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>
|
Reference in New Issue
Block a user