From 6472f158a43733583c77b2a0a3415847d342f2a6 Mon Sep 17 00:00:00 2001 From: Hanchen Wang Date: Wed, 11 May 2016 10:06:05 -0400 Subject: [PATCH] hugelib: Add expiredCount as a Site variable --- hugolib/site.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hugolib/site.go b/hugolib/site.go index 679fd202a..b803864b1 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -89,6 +89,7 @@ type Site struct { RunMode runmode draftCount int futureCount int + expiredCount int Data map[string]interface{} } @@ -1006,6 +1007,10 @@ func (s *Site) addPage(page *Page) { if page.IsFuture() { s.futureCount++ } + + if page.IsExpired() { + s.expiredCount++ + } } func (s *Site) removePageByPath(path string) { @@ -1020,6 +1025,10 @@ func (s *Site) removePageByPath(path string) { s.futureCount-- } + if page.IsExpired() { + s.expiredCount-- + } + s.Pages = append(s.Pages[:i], s.Pages[i+1:]...) } } @@ -1034,6 +1043,10 @@ func (s *Site) removePage(page *Page) { s.futureCount-- } + if page.IsExpired() { + s.expiredCount-- + } + s.Pages = append(s.Pages[:i], s.Pages[i+1:]...) } }