mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 19:15:16 +02:00
Fix error when menu URL shorter than 4 characters is set
Fix the error when calling slicestr to slice out-of-range bounds See #439
This commit is contained in:
parent
0514bbd48d
commit
a42037eadd
1 changed files with 7 additions and 5 deletions
|
@ -51,11 +51,13 @@
|
|||
</li>
|
||||
|
||||
{{ else }}
|
||||
|
||||
{{ if eq "http" (slicestr .URL 0 4) }}
|
||||
{{ $.Scratch.Set "target" " target=\"_blank\" rel=\"noopener\"" }}
|
||||
{{ else }}
|
||||
{{ $.Scratch.Set "target" "" }}
|
||||
|
||||
{{/* Set target for link. */}}
|
||||
{{ $.Scratch.Set "target" "" }}
|
||||
{{ if gt (len .URL) 4 }}
|
||||
{{ if eq "http" (slicestr .URL 0 4) }}
|
||||
{{ $.Scratch.Set "target" " target=\"_blank\" rel=\"noopener\"" }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<li class="nav-item">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue