hugo-theme-relearn/layouts/partials/_relearn/relBaseUri.gotmpl

10 lines
435 B
Go Template
Raw Normal View History

2024-03-18 20:58:53 +00:00
{{- /* generates an uphill path from the current page to the root of the server */}}
{{- $subdir := strings.TrimSuffix (relLangURL "/") (relLangURL "") }}
{{- $relBaseUri := .RelPermalink }}
{{- $relBaseUri = replaceRE "/[^/]*$" "" $relBaseUri }}
{{- $relBaseUri = replaceRE "/[^/]*" "/.." $relBaseUri }}
{{- $relBaseUri = trim $relBaseUri "/" }}
{{- if not $relBaseUri }}
{{- $relBaseUri = "." }}
{{- end }}
{{- return $relBaseUri }}