diff --git a/layouts/partials/relBasePath.hugo b/layouts/partials/relBasePath.hugo new file mode 100644 index 0000000000..bcdd0e7c9c --- /dev/null +++ b/layouts/partials/relBasePath.hugo @@ -0,0 +1,11 @@ +{{- /* generates an uphill path from the current page to the root of the site */}} +{{- $subdir := strings.TrimSuffix (relLangURL "/") (relLangURL "") }} +{{- $relBasePath := .RelPermalink }} +{{- $relBasePath = replaceRE "/[^/]*$" "" $relBasePath }} +{{- $relBasePath = strings.TrimPrefix $subdir $relBasePath }} +{{- $relBasePath = replaceRE "/[^/]*" "/.." $relBasePath }} +{{- $relBasePath = trim $relBasePath "/" }} +{{- if not $relBasePath }} + {{- $relBasePath = "." }} +{{- end }} +{{- return $relBasePath }} \ No newline at end of file diff --git a/layouts/partials/stylesheet.html b/layouts/partials/stylesheet.html index d815918093..55ce0c229a 100644 --- a/layouts/partials/stylesheet.html +++ b/layouts/partials/stylesheet.html @@ -30,8 +30,8 @@