From 5f40e57d176b3656310360941020b190826b0b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Mon, 18 Mar 2024 21:56:21 +0100 Subject: [PATCH] [theme] rename baseUri to relBasePath #813 --- layouts/partials/relBasePath.hugo | 11 +++++++++++ layouts/partials/stylesheet.html | 2 +- layouts/partials/toBaseRelURL.hugo | 10 ---------- static/js/theme.js | 10 +++++----- 4 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 layouts/partials/relBasePath.hugo delete mode 100644 layouts/partials/toBaseRelURL.hugo 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 @@