shithub: hugo

Download patch

ref: 6472f158a43733583c77b2a0a3415847d342f2a6
parent: d4156e61277f4a006670a9eb1acba8b98140c5ef
author: Hanchen Wang <[email protected]>
date: Wed May 11 06:06:05 EDT 2016

hugelib: Add expiredCount as a Site variable

--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -89,6 +89,7 @@
 	RunMode        runmode
 	draftCount     int
 	futureCount    int
+	expiredCount   int
 	Data           map[string]interface{}
 }
 
@@ -1006,6 +1007,10 @@
 	if page.IsFuture() {
 		s.futureCount++
 	}
+
+	if page.IsExpired() {
+		s.expiredCount++
+	}
 }
 
 func (s *Site) removePageByPath(path string) {
@@ -1020,6 +1025,10 @@
 			s.futureCount--
 		}
 
+		if page.IsExpired() {
+			s.expiredCount--
+		}
+
 		s.Pages = append(s.Pages[:i], s.Pages[i+1:]...)
 	}
 }
@@ -1032,6 +1041,10 @@
 
 		if page.IsFuture() {
 			s.futureCount--
+		}
+
+		if page.IsExpired() {
+			s.expiredCount--
 		}
 
 		s.Pages = append(s.Pages[:i], s.Pages[i+1:]...)