diff --git a/README.md b/README.md index ff823fd7..ca6c6136 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,7 @@ There is a single parameter object with sensible defaults that can be overridden ```toml [paige] 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 style = "" # CSS included at the end of the stylesheet, before style-last.css diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html new file mode 100644 index 00000000..9cc0acd1 --- /dev/null +++ b/layouts/_default/_markup/render-link.html @@ -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 }} +{{ .Text }}