diff options
-rw-r--r-- | hugolib/hugo_sites_build.go | 8 | ||||
-rw-r--r-- | hugolib/site.go | 12 |
2 files changed, 18 insertions, 2 deletions
diff --git a/hugolib/hugo_sites_build.go b/hugolib/hugo_sites_build.go index 970948bb3..e694ab52f 100644 --- a/hugolib/hugo_sites_build.go +++ b/hugolib/hugo_sites_build.go @@ -174,11 +174,19 @@ func (h *HugoSites) assemble(config *BuildCfg) error { } for _, s := range h.Sites { + s.siteStats = &siteStats{} for _, p := range s.Pages { // May have been set in front matter if len(p.outputFormats) == 0 { p.outputFormats = s.outputFormats[p.Kind] } + + cnt := len(p.outputFormats) + if p.Kind == KindPage { + s.siteStats.pageCountRegular += cnt + } + s.siteStats.pageCount += cnt + if err := p.initTargetPathDescriptor(); err != nil { return err } diff --git a/hugolib/site.go b/hugolib/site.go index e3a896148..536bf738b 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -115,6 +115,13 @@ type Site struct { // Logger etc. *deps.Deps `json:"-"` + + siteStats *siteStats +} + +type siteStats struct { + pageCount int + pageCountRegular int } func (s *Site) isEnabled(kind string) bool { @@ -1734,12 +1741,13 @@ func (s *Site) appendThemeTemplates(in []string) []string { // Stats prints Hugo builds stats to the console. // This is what you see after a successful hugo build. func (s *Site) Stats() { + s.Log.FEEDBACK.Printf("Built site for language %s:\n", s.Language.Lang) s.Log.FEEDBACK.Println(s.draftStats()) s.Log.FEEDBACK.Println(s.futureStats()) s.Log.FEEDBACK.Println(s.expiredStats()) - s.Log.FEEDBACK.Printf("%d regular pages created\n", len(s.RegularPages)) - s.Log.FEEDBACK.Printf("%d other pages created\n", (len(s.Pages) - len(s.RegularPages))) + s.Log.FEEDBACK.Printf("%d regular pages created\n", s.siteStats.pageCountRegular) + s.Log.FEEDBACK.Printf("%d other pages created\n", (s.siteStats.pageCount - s.siteStats.pageCountRegular)) s.Log.FEEDBACK.Printf("%d non-page files copied\n", len(s.Files)) s.Log.FEEDBACK.Printf("%d paginator pages created\n", s.Info.paginationPageCount) |