From 06d546c52c5a1c5a352ec21cd2e8f1b15b52dcfd Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Mon, 26 Nov 2018 15:38:17 -0800 Subject: [PATCH] Fix some mishandling of path separators, leading to problems on Windows. (#2920) --- layouts/shortcodes/relnote_links.html | 8 +------- layouts/shortcodes/template_table.html | 6 ++---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/layouts/shortcodes/relnote_links.html b/layouts/shortcodes/relnote_links.html index 184f546d1d..0b4654453b 100644 --- a/layouts/shortcodes/relnote_links.html +++ b/layouts/shortcodes/relnote_links.html @@ -1,10 +1,4 @@ -{{ $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 }} - +{{ $dir_name := path.Base .Page.Dir }} {{ $parts := split $dir_name "." }} {{ $short_version := $dir_name }} diff --git a/layouts/shortcodes/template_table.html b/layouts/shortcodes/template_table.html index 6354634485..6fb4ee9253 100644 --- a/layouts/shortcodes/template_table.html +++ b/layouts/shortcodes/template_table.html @@ -14,13 +14,11 @@ {{- .Title -}} - {{ $current_template := split .Dir "/" | last 2 }} - {{ $current_template := index $current_template 0 }} + {{ $current_template := path.Base .Dir }} {{ $adapters := "" }} {{ range $a := $adapterPages }} - {{ $adapter_name := split $a.Dir "/" | last 2 }} - {{ $adapter_name := index $adapter_name 0 }} + {{ $adapter_name := path.Base $a.Dir }} {{ $templates := split .Params.supported_templates "," }} {{ $templates := sort $templates }}