mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-27 03:25:16 +02:00
navbar: Open external links in new tab
This commit is contained in:
parent
87d24014c8
commit
524b562ea6
1 changed files with 7 additions and 1 deletions
|
@ -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 }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue