summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Braz <alanbraz@br.ibm.com>2022-08-15 08:01:24 -0300
committerFelix Börner <github@felix-boerner.de>2022-09-22 20:23:23 +0200
commit84dc86929b332b4e0fdde8651d8fb9ed50e35a42 (patch)
tree590565e4fd2fb95827d61380be18b667f13184e5
parentb4bbd943ffd7bfeb7d8000879850c06509fb8b23 (diff)
open links at new tab by default
-rw-r--r--README.md2
-rw-r--r--exampleSite/config.toml2
-rw-r--r--layouts/partials/links.html2
3 files changed, 5 insertions, 1 deletions
diff --git a/README.md b/README.md
index f7453be..964de64 100644
--- a/README.md
+++ b/README.md
@@ -144,10 +144,12 @@ This is what generates one link list:
[[params.links.list1.link]]
text = "Blog"
url = "#"
+ new_tab = true # Default, new tab
[[params.links.list1.link]]
text = "Email"
url = "#"
+ new_tab = false # open at same tab
[[params.links.list1.link]]
text = "Newsletter"
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 7c78094..cbdae0b 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -52,10 +52,12 @@ copyright = "&copy;2021 Your Name"
[[params.links.list1.link]]
text = "Blog"
url = "#"
+ new_tab = true # Default, new tab
[[params.links.list1.link]]
text = "Email"
url = "#"
+ new_tab = false # open at same tab
[[params.links.list1.link]]
text = "Newsletter"
diff --git a/layouts/partials/links.html b/layouts/partials/links.html
index ecfe949..390bf1e 100644
--- a/layouts/partials/links.html
+++ b/layouts/partials/links.html
@@ -8,7 +8,7 @@
<h3>{{ $list.heading }}</h3>
<ul>
{{ range $list.link }}
- <li><a href="{{ .url | safeURL }}" title="{{ .text }}">{{ .text }}</a></li>
+ <li><a href="{{ .url | safeURL }}" title="{{ .text }}" target={{ cond (.new_tab | default true) "_blank" "_self"}}>{{ .text }}</a></li>
{{ end }}
</ul>
</div>