mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
Add a way to merge pages by language
As an example: ```html {{ $pages := .Site.RegularPages | lang.Merge $frSite.RegularPages | lang.Merge $enSite.RegularPages }} ``` Will "fill in the gaps" in the current site with, from left to right, content from the French site, and lastly the English. Fixes #4463
This commit is contained in:
@@ -348,6 +348,16 @@ func NewSiteForCfg(cfg deps.DepsCfg) (*Site, error) {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
type SiteInfos []*SiteInfo
|
||||
|
||||
// First is a convenience method to get the first Site, i.e. the main language.
|
||||
func (s SiteInfos) First() *SiteInfo {
|
||||
if len(s) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s[0]
|
||||
}
|
||||
|
||||
type SiteInfo struct {
|
||||
Taxonomies TaxonomyList
|
||||
Authors AuthorList
|
||||
|
Reference in New Issue
Block a user