From 5b01424e52c23a3f76182db9a7e24b6dbff3a61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 8 Jan 2019 12:13:45 +0100 Subject: [PATCH] Work --- hugolib/hugo_sites.go | 7 ++++--- hugolib/hugo_sites_build_test.go | 6 +++--- hugolib/page.go | 19 ------------------- hugolib/page_content.go | 2 +- hugolib/pagebundler_handlers.go | 2 +- hugolib/site.go | 19 +++++++++++++++++++ resources/page/page.go | 6 ++++++ 7 files changed, 34 insertions(+), 27 deletions(-) diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index d850d397539..72ded4b91e0 100644 --- a/hugolib/hugo_sites.go +++ b/hugolib/hugo_sites.go @@ -642,14 +642,15 @@ func (h *HugoSites) setupTranslations() { pp := p.(*Page) if p.Kind() == kindUnknown { pp.kind = pp.kindFromSections() + } if !pp.s.isEnabled(p.Kind()) { continue } - shouldBuild := pp.shouldBuild() - s.updateBuildStats(pp) + shouldBuild := s.shouldBuild(p) + s.updateBuildStats(p) if shouldBuild { if pp.headless { s.headlessPages = append(s.headlessPages, p) @@ -724,7 +725,7 @@ func handleShortcodes(p *PageWithoutContent, rawContentCopy []byte) ([]byte, err return rawContentCopy, nil } -func (s *Site) updateBuildStats(page *Page) { +func (s *Site) updateBuildStats(page page.Page) { if page.IsDraft() { s.draftCount++ } diff --git a/hugolib/hugo_sites_build_test.go b/hugolib/hugo_sites_build_test.go index 3b78459b15e..21a6e61d3dc 100644 --- a/hugolib/hugo_sites_build_test.go +++ b/hugolib/hugo_sites_build_test.go @@ -623,11 +623,11 @@ func assertShouldNotBuild(t *testing.T, sites *HugoSites) { for _, p := range s.rawAllPages { pp := p.(*Page) // No HTML when not processed - require.Equal(t, pp.shouldBuild(), bytes.Contains(pp.workContent, []byte("