Update lang.Merge.md

This commit is contained in:
Bjørn Erik Pedersen 2018-12-07 16:40:48 +01:00 committed by GitHub
parent b37af2916e
commit 4b021eff81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 }}
{{ .Scratch.Set "pages" ($pages | lang.Merge $mainSite.RegularPages) }}
{{ end }} {{ end }}
{{ $pages := .Scratch.Get "pages" }}
``` ```
{{% note %}} {{% note %}}