mirror of
https://github.com/gohugoio/hugo.git
synced 2025-02-20 01:31:57 +00:00
hugolib: Update site stats to take output formats into account
This commit is contained in:
parent
d851d6b98f
commit
0c4701f0ef
2 changed files with 18 additions and 2 deletions
|
@ -174,11 +174,19 @@ func (h *HugoSites) assemble(config *BuildCfg) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range h.Sites {
|
for _, s := range h.Sites {
|
||||||
|
s.siteStats = &siteStats{}
|
||||||
for _, p := range s.Pages {
|
for _, p := range s.Pages {
|
||||||
// May have been set in front matter
|
// May have been set in front matter
|
||||||
if len(p.outputFormats) == 0 {
|
if len(p.outputFormats) == 0 {
|
||||||
p.outputFormats = s.outputFormats[p.Kind]
|
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 {
|
if err := p.initTargetPathDescriptor(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,13 @@ type Site struct {
|
||||||
|
|
||||||
// Logger etc.
|
// Logger etc.
|
||||||
*deps.Deps `json:"-"`
|
*deps.Deps `json:"-"`
|
||||||
|
|
||||||
|
siteStats *siteStats
|
||||||
|
}
|
||||||
|
|
||||||
|
type siteStats struct {
|
||||||
|
pageCount int
|
||||||
|
pageCountRegular int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Site) isEnabled(kind string) bool {
|
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.
|
// Stats prints Hugo builds stats to the console.
|
||||||
// This is what you see after a successful hugo build.
|
// This is what you see after a successful hugo build.
|
||||||
func (s *Site) Stats() {
|
func (s *Site) Stats() {
|
||||||
|
|
||||||
s.Log.FEEDBACK.Printf("Built site for language %s:\n", s.Language.Lang)
|
s.Log.FEEDBACK.Printf("Built site for language %s:\n", s.Language.Lang)
|
||||||
s.Log.FEEDBACK.Println(s.draftStats())
|
s.Log.FEEDBACK.Println(s.draftStats())
|
||||||
s.Log.FEEDBACK.Println(s.futureStats())
|
s.Log.FEEDBACK.Println(s.futureStats())
|
||||||
s.Log.FEEDBACK.Println(s.expiredStats())
|
s.Log.FEEDBACK.Println(s.expiredStats())
|
||||||
s.Log.FEEDBACK.Printf("%d regular pages created\n", len(s.RegularPages))
|
s.Log.FEEDBACK.Printf("%d regular pages created\n", s.siteStats.pageCountRegular)
|
||||||
s.Log.FEEDBACK.Printf("%d other pages created\n", (len(s.Pages) - len(s.RegularPages)))
|
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 non-page files copied\n", len(s.Files))
|
||||||
s.Log.FEEDBACK.Printf("%d paginator pages created\n", s.Info.paginationPageCount)
|
s.Log.FEEDBACK.Printf("%d paginator pages created\n", s.Info.paginationPageCount)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue