diff --git a/layouts/partials/toBaseRelURL.hugo b/layouts/partials/toBaseRelURL.hugo index 81d21ff1cd..677d3fa084 100644 --- a/layouts/partials/toBaseRelURL.hugo +++ b/layouts/partials/toBaseRelURL.hugo @@ -1,7 +1,8 @@ -{{- $url := partial "relLangPrettyUglyURL.hugo" (dict "to" .) }} -{{- $url = path.Clean $url }} +{{- $url := .RelPermalink }} {{- $url = replaceRE "/[^/]*$" "" $url }} -{{- $url = replaceRE "/[^/]*" "/.." $url }} -{{- $url = replaceRE "^/" "" $url }} -{{- $url = replaceRE "/$" "" $url }} -{{- return $url }} \ No newline at end of file +{{- $home_url := .Site.Home.RelPermalink }} +{{- $home_url = replaceRE "/[^/]*$" "" $home_url }} +{{- $rel_url := strings.TrimPrefix $home_url $url }} +{{- $rel_url = replaceRE "/[^/]*" "/.." $rel_url }} +{{- $rel_url = trim $rel_url "/" }} +{{- return $rel_url }} \ No newline at end of file