aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exampleSite/config.toml4
-rw-r--r--exampleSite/config.yaml4
-rw-r--r--layouts/partials/docs/languages.html7
3 files changed, 13 insertions, 2 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 2db8e57..165bc10 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -105,3 +105,7 @@ enableGitInfo = true
# /!\ This is an experimental feature, might be removed or changed at any time
# (Optional, experimental, default false) Enables service worker that caches visited pages and resources for offline use.
BookServiceWorker = true
+
+ # /!\ This is an experimental feature, might be removed or changed at any time
+ # (Optional, experimental, default false) Enables a drop-down menu for translations only if a translation is present.
+ BookTranslatedOnly = true
diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml
index 0367f8e..4d582bc 100644
--- a/exampleSite/config.yaml
+++ b/exampleSite/config.yaml
@@ -101,3 +101,7 @@ params:
# /!\ This is an experimental feature, might be removed or changed at any time
# (Optional, experimental, default false) Enables service worker that caches visited pages and resources for offline use.
BookServiceWorker: true
+
+ # /!\ This is an experimental feature, might be removed or changed at any time
+ # (Optional, experimental, default false) Enables a drop-down menu for translations only if a translation is present.
+ BookTranslatedOnly: true
diff --git a/layouts/partials/docs/languages.html b/layouts/partials/docs/languages.html
index 14e0e2c..4020275 100644
--- a/layouts/partials/docs/languages.html
+++ b/layouts/partials/docs/languages.html
@@ -1,7 +1,10 @@
<!-- Merge home and current page translations -->
+{{ $bookTranslatedOnly := default false .Site.Params.BookTranslatedOnly }}
{{ $translations := dict }}
-{{ range .Site.Home.AllTranslations }}
- {{ $translations = merge $translations (dict .Language.Lang .) }}
+{{ if (eq $bookTranslatedOnly false ) }}
+ {{ range .Site.Home.AllTranslations }}
+ {{ $translations = merge $translations (dict .Language.Lang .) }}
+ {{ end }}
{{ end }}
{{ range .Translations }}
{{ $translations = merge $translations (dict .Language.Lang .) }}