mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-10 03:04:41 -04:00
Update lang.Merge.md
This commit is contained in:
parent
b37af2916e
commit
4b021eff81
@ -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 %}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user