diff --git a/layouts/shortcodes/internalLink.html b/layouts/shortcodes/internalLink.html index 2d60bea..1045181 100644 --- a/layouts/shortcodes/internalLink.html +++ b/layouts/shortcodes/internalLink.html @@ -1,18 +1,26 @@ - + {{ $path := .Get "path" }} -{{ $lang := .Get "lang" }} {{ $currentLang := .Page.Lang }} -{{ range .Page.Sites }} -{{ if eq .Language.Lang $lang }} +{{ $sites := .Page.Sites }} +{{ if ne $currentLang (index .Page.Sites 0).Language.Lang }} +{{ $sites = collections.Reverse .Page.Sites }} +{{ end }} +{{ range $sites }} {{ with .GetPage $path }} {{ .Title }} -{{ if ne $currentLang $lang }} +{{ if and (eq $currentLang "en") (eq .Lang "fr") }} +{{- partial "icons/fr.svg" . -}} +{{ end }} +{{ if (eq $currentLang "fr") }} +{{- partial "lang-detection.html" . -}} +{{ if .Scratch.Get "en_article_in_fr_site" }} {{- partial "icons/en.svg" . -}} {{ end }} -{{ else }} -{{ errorf "shortcode internalLink: Cannot find page %q with lang %q" $path $lang }} {{ end }} +{{ break }} {{ end }} {{ end }}