diff --git a/exampleSite/content/basics/configuration/_index.en.md b/exampleSite/content/basics/configuration/_index.en.md index a7b4f403fa..f894055f70 100644 --- a/exampleSite/content/basics/configuration/_index.en.md +++ b/exampleSite/content/basics/configuration/_index.en.md @@ -86,6 +86,8 @@ Note that some of these parameters are explained in details in other sections of # If set to true, no index.html will be appended to prettyURLs; this will cause pages not # to be servable from the file system disableExplicitIndexURLs = false + # For external links you can define how they are opened in your browser; this setting will only be applied to the content area but not the shortcut menu + externalLinkTarget = "_blank" ``` ## Serving your page from a subfolder diff --git a/exampleSite/content/basics/migration/_index.en.md b/exampleSite/content/basics/migration/_index.en.md index 5c0496125d..0ad22f1f79 100644 --- a/exampleSite/content/basics/migration/_index.en.md +++ b/exampleSite/content/basics/migration/_index.en.md @@ -22,6 +22,9 @@ This document shows you what's new in the latest release. For a detailed list of This added unnessessary complexity. So attachments for leaf bundles in non-multilang setups can now also reside in a `index.files` directory. Although the old `files` directory is now deprecated, if both directories are present, only the old `files` directory will be used for compatiblity. + You can revert back to the old behavior by defining `externalLinkTarget="_self"` in your in the `params` section of your `config.toml`. + + - {{% badge style="note" title=" " %}}Change{{% /badge %}} Absolute links prefixed with `http://` or `https://` are now opened in a separate browser tab. - {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} The theme now supports [Hugo's module system](https://gohugo.io/hugo-modules/). diff --git a/layouts/partials/header.html b/layouts/partials/header.html index b8093d5c86..28941fcd9d 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -90,7 +90,7 @@ {{- if and (eq $outputFormat "html") .Site.Params.editURL $File }} {{- with $File.Path }} diff --git a/layouts/partials/shortcodes/button.html b/layouts/partials/shortcodes/button.html index 8621481a10..31d8b5acbf 100644 --- a/layouts/partials/shortcodes/button.html +++ b/layouts/partials/shortcodes/button.html @@ -13,6 +13,9 @@ {{- end }} {{- else if and (eq (len $target) 0) (or (strings.HasPrefix $href "http://") (strings.HasPrefix $href "https://") ) }} {{- $target = "_blank" }} + {{- if isset $context.Site.Params "externallinktarget" }} + {{- $target = $context.Site.Params.externalLinkTarget }} + {{- end }} {{- end }} {{- $title := .title | default ($content) | default ($style | T) }} {{- $title = trim $title " " }} @@ -33,7 +36,7 @@ {{- if $isButton }} {{- else }} - + {{- end }} {{- if and $icon (eq $iconposition "left") }} diff --git a/layouts/partials/shortcodes/link.html b/layouts/partials/shortcodes/link.html index faf18543a6..913cfcda0e 100644 --- a/layouts/partials/shortcodes/link.html +++ b/layouts/partials/shortcodes/link.html @@ -6,5 +6,8 @@ {{- $target := .target | default "" }} {{- if and (eq (len $target) 0) (or (strings.HasPrefix $url "http://") (strings.HasPrefix $url "https://") ) }} {{- $target = "_blank" }} + {{- if isset $context.Page.Site.Params "externallinktarget" }} + {{- $target = $context.Page.Site.Params.externalLinkTarget }} + {{- end }} {{- end -}} -{{ $content | safeHTML }} \ No newline at end of file +{{ $content | safeHTML }} \ No newline at end of file