You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
884 B
26 lines
884 B
<!-- This shortcode generates the HTML link to an internal resource, which can be translated or not.
|
|
-- It displays a country flag when the target page is in a different language than the current page.
|
|
-- Currently, this shortcode can only handle Hugo sites with two languages. -->
|
|
{{ $path := .Get "path" }}
|
|
{{ $currentLang := .Page.Lang }}
|
|
{{ $sites := .Page.Sites }}
|
|
{{ if ne $currentLang (index .Page.Sites 0).Language.Lang }}
|
|
{{ $sites = collections.Reverse .Page.Sites }}
|
|
{{ end }}
|
|
{{ range $sites }}
|
|
{{ with .GetPage $path }}
|
|
<a href="{{ .RelPermalink }}">
|
|
{{ .Title }}
|
|
</a>
|
|
{{ 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 }}
|
|
{{ end }}
|
|
{{ break }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|