mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 18:15:31 +00:00
navbar: Open external links in new tab
This commit is contained in:
1 parent
87d24014c8
commit
524b562ea6
1 file changed
+7
-1
@@ -52,8 +52,14 @@
|
||||
|
||||
{{ else }}
|
||||
|
||||
{{ if eq "http" (slicestr .URL 0 4) }}
|
||||
{{ $.Scratch.Set "target" " target=\"_blank\" rel=\"noopener\"" }}
|
||||
{{ else }}
|
||||
{{ $.Scratch.Set "target" "" }}
|
||||
{{ end }}
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="{{ .URL | relLangURL }}"{{ if $.IsHome }} data-target="{{ .URL }}"{{ end }}>
|
||||
<a href="{{ .URL | relLangURL }}"{{ if $.IsHome }} data-target="{{ (slicestr .URL 0 4) }}{{ .URL }}"{{ end }}{{ ($.Scratch.Get "target") | safeHTMLAttr }}>
|
||||
{{ .Pre }}
|
||||
<span>{{ .Name }}</span>
|
||||
{{ .Post }}
|
||||
|
||||
Reference in new issue
Block a user