github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/relBasePath.hugo (about) 1 {{- /* generates an uphill path from the current page to the root of the site */}} 2 {{- $subdir := strings.TrimSuffix (relLangURL "/") (relLangURL "") }} 3 {{- $relBasePath := .RelPermalink }} 4 {{- $relBasePath = replaceRE "/[^/]*$" "" $relBasePath }} 5 {{- $relBasePath = strings.TrimPrefix $subdir $relBasePath }} 6 {{- $relBasePath = replaceRE "/[^/]*" "/.." $relBasePath }} 7 {{- $relBasePath = trim $relBasePath "/" }} 8 {{- if not $relBasePath }} 9 {{- $relBasePath = "." }} 10 {{- end }} 11 {{- return $relBasePath }}