mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +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:
@@ -263,6 +263,16 @@ type Page struct {
|
||||
targetPathDescriptorPrototype *targetPathDescriptor
|
||||
}
|
||||
|
||||
// Sites is a convenience method to get all the Hugo sites/languages configured.
|
||||
func (p *Page) Sites() SiteInfos {
|
||||
infos := make(SiteInfos, len(p.s.owner.Sites))
|
||||
for i, site := range p.s.owner.Sites {
|
||||
infos[i] = &site.Info
|
||||
}
|
||||
|
||||
return infos
|
||||
}
|
||||
|
||||
// SearchKeywords implements the related.Document interface needed for fast page searches.
|
||||
func (p *Page) SearchKeywords(cfg related.IndexConfig) ([]related.Keyword, error) {
|
||||
|
||||
|
Reference in New Issue
Block a user