diff options
author | Bjørn Erik Pedersen <[email protected]> | 2018-02-25 10:50:44 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2018-02-25 10:50:44 +0100 |
commit | e39797fa720829dafd165aa25bfc2605700c38dc (patch) | |
tree | e823aa3909084bb2d22e4ba81c9007d9b2e6fccb /hugolib/site_sections.go | |
parent | 00868081f624928d773a7b698654766f8cd70069 (diff) | |
download | hugo-e39797fa720829dafd165aa25bfc2605700c38dc.tar.gz hugo-e39797fa720829dafd165aa25bfc2605700c38dc.zip |
hugolib: Avoid scanning entire site to find the home
See #4447
Diffstat (limited to 'hugolib/site_sections.go')
-rw-r--r-- | hugolib/site_sections.go | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/hugolib/site_sections.go b/hugolib/site_sections.go index 5de350b2f..c8bca03e3 100644 --- a/hugolib/site_sections.go +++ b/hugolib/site_sections.go @@ -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 { |