From 4b021eff81a6a1f1bd1298159dbd744a5f1dd60c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 7 Dec 2018 16:40:48 +0100 Subject: [PATCH] Update lang.Merge.md --- content/en/functions/lang.Merge.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/content/en/functions/lang.Merge.md b/content/en/functions/lang.Merge.md index 6e1d41c0f..ecdab3c42 100644 --- a/content/en/functions/lang.Merge.md +++ b/content/en/functions/lang.Merge.md @@ -29,17 +29,13 @@ As an example: Will "fill in the gaps" in the current site with, from left to right, content from the French site, and lastly the English. -A more practical example is to fill in the missing translations for the "minority languages" with content from the main language: - +A more practical example is to fill in the missing translations from the other languages: ```bash - {{ $pages := .Site.RegularPages }} - {{ .Scratch.Set "pages" $pages }} - {{ $mainSite := .Sites.First }} - {{ if ne $mainSite .Site }} - {{ .Scratch.Set "pages" ($pages | lang.Merge $mainSite.RegularPages) }} - {{ end }} - {{ $pages := .Scratch.Get "pages" }} +{{ $pages := .Site.RegularPages }} +{{ range .Site.Home.Translations }} +{{ $pages = $pages | lang.Merge .Site.RegularPages }} +{{ end }} ``` {{% note %}}