mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
00868081f6
commit
e39797fa72
2 changed files with 10 additions and 7 deletions
|
@ -152,6 +152,15 @@ func (*PageCollections) findPagesByKindIn(kind string, inPages Pages) Pages {
|
|||
return pages
|
||||
}
|
||||
|
||||
func (*PageCollections) findFirstPageByKindIn(kind string, inPages Pages) *Page {
|
||||
for _, p := range inPages {
|
||||
if p.Kind == kind {
|
||||
return p
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*PageCollections) findPagesByKindNotIn(kind string, inPages Pages) Pages {
|
||||
var pages Pages
|
||||
for _, p := range inPages {
|
||||
|
|
|
@ -161,18 +161,12 @@ func (s *Site) assembleSections() Pages {
|
|||
)
|
||||
|
||||
var (
|
||||
home *Page
|
||||
inPages = radix.New().Txn()
|
||||
inSections = radix.New().Txn()
|
||||
undecided Pages
|
||||
)
|
||||
|
||||
homes := s.findPagesByKind(KindHome)
|
||||
if len(homes) == 1 {
|
||||
home = homes[0]
|
||||
} else if len(homes) > 1 {
|
||||
panic("Too many homes")
|
||||
}
|
||||
home := s.findFirstPageByKindIn(KindHome, s.Pages)
|
||||
|
||||
for i, p := range s.Pages {
|
||||
if p.Kind != KindPage {
|
||||
|
|
Loading…
Reference in a new issue