From 3624bb38f15fc45d580e8c24cbc944573dd24f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sat, 19 Nov 2022 13:40:26 +0100 Subject: [PATCH] theme: be compatible with Hugo >= 0.95.0 #397 --- layouts/partials/BaseName.hugo | 2 ++ layouts/partials/header.html | 2 +- layouts/partials/menu.html | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 layouts/partials/BaseName.hugo diff --git a/layouts/partials/BaseName.hugo b/layouts/partials/BaseName.hugo new file mode 100644 index 0000000000..a383b7e602 --- /dev/null +++ b/layouts/partials/BaseName.hugo @@ -0,0 +1,2 @@ +{{- $ret := path.Base (strings.TrimSuffix (path.Ext .) .) }} +{{- return $ret }} \ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 68fa8cf10b..b8093d5c86 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -3,7 +3,7 @@ {{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} {{- $basename := "index" }} {{- if eq $outputFormat "searchpage" }} - {{- $basename = path.BaseName $format.RelPermalink }} + {{- $basename = partial "BaseName.hugo" $format.RelPermalink }} {{- end }} diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index a374a29e50..edc3b17bef 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -4,7 +4,7 @@ {{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} {{- $basename := "index" }} {{- if ne $outputFormat "html" }} - {{- $basename = path.BaseName $format.RelPermalink }} + {{- $basename = partial "BaseName.hugo" $format.RelPermalink }} {{- end }}