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>
This commit is contained in:
parent
e53a638b2c
commit
c828c6660f
3 changed files with 13 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 .) }}
|
||||
|
|
Loading…
Reference in a new issue