diff options
author | Alex Ivanov <ai@contributor.pw> | 2021-01-21 13:42:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-21 11:42:26 +0100 |
commit | c828c6660f32da34e118fad039bc01602ba0251a (patch) | |
tree | ada8804a3546b21cc9c082511ee52eceaec6dbd1 | |
parent | e53a638b2c814c99c8582a6bdda643e6cc268280 (diff) |
Add OnlyTranslated property (#303)
* Add OnlyTranslated property
Signed-off-by: Alex Ivanov <ai@contributor.pw>
* Add newlines
Signed-off-by: Alex Ivanov <ai@contributor.pw>
* rename property
Signed-off-by: Alex Ivanov <ai@contributor.pw>
-rw-r--r-- | exampleSite/config.toml | 4 | ||||
-rw-r--r-- | exampleSite/config.yaml | 4 | ||||
-rw-r--r-- | layouts/partials/docs/languages.html | 7 |
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 .) }} |