hugo-theme-relearn/layouts/partials/toBaseRelURL.hugo

10 lines
359 B
Text
Raw Normal View History

{{- $subdir := strings.TrimSuffix (relLangURL "/") (relLangURL "") }}
{{- $url := .RelPermalink }}
{{- $url = replaceRE "/[^/]*$" "" $url }}
{{- $rel_url := strings.TrimPrefix $subdir $url }}
{{- $rel_url = replaceRE "/[^/]*" "/.." $rel_url }}
{{- $rel_url = trim $rel_url "/" }}
{{- if not $rel_url }}
{{- $rel_url = "." }}
{{- end }}
{{- return $rel_url }}