Compensate for a Hugo bug when running on Windows. (#2919)

This commit is contained in:
Martin Taillefer 2018-11-26 09:41:01 -08:00 committed by GitHub
parent c57216f4d3
commit 35b41b1e20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -1,4 +1,10 @@
{{ $dir_name := index (last 2 (split .Page.Dir "/" )) 0 }}
{{/* Compensate for a Hugo bug on Windows where it appends a \ on the output of .Page.Dir */}}
{{ if (strings.HasSuffix $dir_name "\\") }}
{{ $dir_name = slicestr $dir_name 0 (sub (len $dir_name) 1) }}
{{ end }}
{{ $parts := split $dir_name "." }}
{{ $short_version := $dir_name }}