|
|
@ -3,6 +3,7 @@ |
|
|
-- Currently, this shortcode can only handle Hugo sites with two languages. --> |
|
|
-- Currently, this shortcode can only handle Hugo sites with two languages. --> |
|
|
{{ $path := .Get "path" }} |
|
|
{{ $path := .Get "path" }} |
|
|
{{ $currentLang := .Page.Lang }} |
|
|
{{ $currentLang := .Page.Lang }} |
|
|
|
|
|
{{ $title := .Get "title" }} |
|
|
{{ $sites := .Page.Sites }} |
|
|
{{ $sites := .Page.Sites }} |
|
|
{{ if ne $currentLang (index .Page.Sites 0).Language.Lang }} |
|
|
{{ if ne $currentLang (index .Page.Sites 0).Language.Lang }} |
|
|
{{ $sites = collections.Reverse .Page.Sites }} |
|
|
{{ $sites = collections.Reverse .Page.Sites }} |
|
|
@ -10,7 +11,11 @@ |
|
|
{{ range $sites }} |
|
|
{{ range $sites }} |
|
|
{{ with .GetPage $path }} |
|
|
{{ with .GetPage $path }} |
|
|
<a href="{{ .RelPermalink }}"> |
|
|
<a href="{{ .RelPermalink }}"> |
|
|
|
|
|
{{ if ne $title "" }} |
|
|
|
|
|
{{ $title }} |
|
|
|
|
|
{{ else }} |
|
|
{{ .Title }} |
|
|
{{ .Title }} |
|
|
|
|
|
{{ end }} |
|
|
</a> |
|
|
</a> |
|
|
{{ if and (eq $currentLang "en") (eq .Lang "fr") }} |
|
|
{{ if and (eq $currentLang "en") (eq .Lang "fr") }} |
|
|
{{- partial "icons/fr.svg" . -}} |
|
|
{{- partial "icons/fr.svg" . -}} |
|
|
|