Update lang.Merge.md

This commit is contained in:
Bjørn Erik Pedersen authored and GitHub committed 2018-12-07 16:40:48 +01:00
1 parent b37af2916e
commit 4b021eff81
1 file changed
+5 -9
+5 -9
View File
@@ -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. 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 ```bash
{{ $pages := .Site.RegularPages }} {{ $pages := .Site.RegularPages }}
{{ .Scratch.Set "pages" $pages }} {{ range .Site.Home.Translations }}
{{ $mainSite := .Sites.First }} {{ $pages = $pages | lang.Merge .Site.RegularPages }}
{{ if ne $mainSite .Site }} {{ end }}
{{ .Scratch.Set "pages" ($pages | lang.Merge $mainSite.RegularPages) }}
{{ end }}
{{ $pages := .Scratch.Get "pages" }}
``` ```
{{% note %}} {{% note %}}