mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
links: handle links to not fully translated pages #377
This commit is contained in:
parent
8b0214e9a5
commit
ff61932b70
1 changed files with 5 additions and 9 deletions
|
@ -31,18 +31,14 @@
|
||||||
{{- $found = true }}
|
{{- $found = true }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- /* is it a link into another translation? */}}
|
{{- /* is it a link into another translation? */}}
|
||||||
{{- range $page.Site.Languages }}
|
{{- range $page.Sites }}
|
||||||
{{- $lang := .Lang }}
|
{{- $lang := .Language.Lang }}
|
||||||
{{- $prefix := printf "%s/" $lang }}
|
{{- $prefix := printf "%s/" $lang }}
|
||||||
{{- if strings.HasPrefix $path $prefix }}
|
{{- if strings.HasPrefix $path $prefix }}
|
||||||
{{- $path = strings.TrimPrefix $prefix $path | default "/" }}
|
{{- $path = strings.TrimPrefix $prefix $path | default "/" }}
|
||||||
{{- with $page.Site.GetPage (strings.TrimSuffix "/" $path | default "/") }}
|
{{- with .GetPage (strings.TrimSuffix "/" $path | default "/") }}
|
||||||
{{- range .Page.AllTranslations }}
|
{{- $url = printf "%s%s" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) $fragment }}
|
||||||
{{- if eq $lang .Lang }}
|
{{- $found = true }}
|
||||||
{{- $url = printf "%s%s" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) $fragment }}
|
|
||||||
{{- $found = true }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
Loading…
Reference in a new issue