mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 10:18:40 +00:00
hugelib: Add expiredCount as a Site variable
This commit is contained in:
1 parent
d4156e6127
commit
6472f158a4
1 file changed
+13
@@ -89,6 +89,7 @@ type Site struct {
|
|||||||
RunMode runmode
|
RunMode runmode
|
||||||
draftCount int
|
draftCount int
|
||||||
futureCount int
|
futureCount int
|
||||||
|
expiredCount int
|
||||||
Data map[string]interface{}
|
Data map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1006,6 +1007,10 @@ func (s *Site) addPage(page *Page) {
|
|||||||
if page.IsFuture() {
|
if page.IsFuture() {
|
||||||
s.futureCount++
|
s.futureCount++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if page.IsExpired() {
|
||||||
|
s.expiredCount++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Site) removePageByPath(path string) {
|
func (s *Site) removePageByPath(path string) {
|
||||||
@@ -1020,6 +1025,10 @@ func (s *Site) removePageByPath(path string) {
|
|||||||
s.futureCount--
|
s.futureCount--
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if page.IsExpired() {
|
||||||
|
s.expiredCount--
|
||||||
|
}
|
||||||
|
|
||||||
s.Pages = append(s.Pages[:i], s.Pages[i+1:]...)
|
s.Pages = append(s.Pages[:i], s.Pages[i+1:]...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1034,6 +1043,10 @@ func (s *Site) removePage(page *Page) {
|
|||||||
s.futureCount--
|
s.futureCount--
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if page.IsExpired() {
|
||||||
|
s.expiredCount--
|
||||||
|
}
|
||||||
|
|
||||||
s.Pages = append(s.Pages[:i], s.Pages[i+1:]...)
|
s.Pages = append(s.Pages[:i], s.Pages[i+1:]...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user