mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
link: fix build error for multilang environments #789
This commit is contained in:
parent
c557b051f7
commit
d81b4dd6eb
1 changed files with 4 additions and 1 deletions
|
@ -34,10 +34,13 @@
|
|||
{{- else }}
|
||||
{{- /* is it a link into another translation? */}}
|
||||
{{- if strings.HasPrefix $path "/" }}
|
||||
{{- range $page.Sites }}
|
||||
{{- range $page.AllTranslations }}
|
||||
{{- $lang := .Language.Lang }}
|
||||
{{- $prefix := printf "/%s" $lang }}
|
||||
{{- $suffix := strings.TrimPrefix $prefix $path | default "/" }}
|
||||
{{- /* with the second check we check if the prefix was finished;
|
||||
eg. /pir/index.html vs. /pirate/index.html, were the latter is
|
||||
an external address outside of this site */}}
|
||||
{{- if and (strings.HasPrefix $path $prefix) (strings.HasPrefix $suffix "/") }}
|
||||
{{- with or
|
||||
(.GetPage $suffix)
|
||||
|
|
Loading…
Reference in a new issue