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:
Elton Chen-Yu Ho 2018-01-08 22:07:40 +03:00 committed by gcushen
commit a42037eadd

View file

@ -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">