version: fix path in version warning #1050

This commit is contained in:
Sören Weber 2025-03-20 23:18:09 +01:00
parent 17771625ba
commit 3de2566a61
No known key found for this signature in database
GPG Key ID: BEC6D55545451B6D
4 changed files with 19 additions and 14 deletions

View File

@ -0,0 +1,12 @@
{{- $home_path := site.Home.RelPermalink }}
{{- $this_path := .RelPermalink }}
{{- $path := print "/" (strings.TrimPrefix $home_path $this_path) }}
{{- $path = partial "permalink.gotmpl" (dict "link" $path) }}
{{- $default_home_lang_path := site.Sites.Default.Home.Permalink }}
{{- $this_home_lang_path := site.Home.Permalink }}
{{- $lang_path := strings.TrimPrefix "/" (strings.TrimPrefix (strings.TrimSuffix "/" $default_home_lang_path) (strings.TrimSuffix "/" $this_home_lang_path)) }}
{{- $lang := .Language.Lang }}
{{- if eq $lang_path $lang }}
{{- $path = printf "/%s%s" $lang_path $path }}
{{- end }}
{{- return $path }}

View File

@ -21,10 +21,13 @@
$latestVersion
(ne $pageVersion.identifier $latestVersion.identifier)
}}
{{- $url := print $latestVersion.baseURL (partial "permalink.gotmpl" (dict "to" .)) }}
{{- $path := partial "_relearn/pageLangPath.gotmpl" . }}
{{- $url := print $latestVersion.baseURL $path }}
{{- warnf "a %s" $url}}
{{- if not $latestVersion.isAbs }}
{{- $url = print (partial "_relearn/relBaseUri.gotmpl" .) $url }}
{{- end }}
{{- warnf "b %s" $url}}
{{- end }}
{{- partial "shortcodes/notice.html" (dict
"page" .
"content" (T "Version-warning" (dict "version" $pageVersion.title "latestUrl" $url ))

View File

@ -114,17 +114,7 @@
{{- end }}
{{- end }}
{{- end }}
{{- $home_path := site.Home.RelPermalink }}
{{- $this_path := .RelPermalink }}
{{- $path := print "/" (strings.TrimPrefix $home_path $this_path) }}
{{- $path = partial "permalink.gotmpl" (dict "link" $path) }}
{{- $default_home_lang_path := site.Sites.Default.Home.Permalink }}
{{- $this_home_lang_path := site.Home.Permalink }}
{{- $lang_path := strings.TrimPrefix "/" (strings.TrimPrefix (strings.TrimSuffix "/" $default_home_lang_path) (strings.TrimSuffix "/" $this_home_lang_path)) }}
{{- $lang := .Language.Lang }}
{{- if eq $lang_path $lang }}
{{- $path = printf "/%s%s" $lang_path $path }}
{{- end }}
{{- $path := partial "_relearn/pageLangPath.gotmpl" . }}
<script>
window.relearn = window.relearn || {};
{{ "// configuration" | safeJS }}

View File

@ -1 +1 @@
7.5.0+b5f8bcc4e397011d3dbec2ca215d641dd7a02689
7.5.0+17771625ba626b69a86cdc46508e4e58633c090d