mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-30 19:23:12 +00:00
11 lines
505 B
Go Template
11 lines
505 B
Go Template
|
{{- /* 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 }}
|