return false
}
+func (page *Page) IsDraft() bool {
+ return page.Draft
+}
+
+func (page *Page) IsFuture() bool {
+ if page.PublishDate.Before(time.Now()) {
+ return false
+ }
+ return true
+}
+
func (p *Page) Permalink() (string, error) {
link, err := p.permalink()
if err != nil {
Completed chan bool
RunMode runmode
params map[string]interface{}
+ draftCount int
+ futureCount int
}
type SiteInfo struct {
s.Pages = append(s.Pages, page)
}
+ if page.IsDraft() {
+ s.draftCount += 1
+ }
+
+ if page.IsFuture() {
+ s.futureCount += 1
+ }
+
return
}(fi)
}
}
func (s *Site) Stats() {
- jww.FEEDBACK.Printf("%d pages created \n", len(s.Pages))
+ jww.FEEDBACK.Println(s.draftStats())
+ jww.FEEDBACK.Println(s.futureStats())
+ jww.FEEDBACK.Printf("%d pages created \n", len(s.Pages))
taxonomies := viper.GetStringMapString("Taxonomies")
return s.Alias.Publish(path, permalink)
}
+
+func (s *Site) draftStats() string {
+ var msg string
+
+ switch s.draftCount {
+ case 0:
+ return "0 draft content "
+ case 1:
+ msg = "1 draft rendered "
+ default:
+ msg = fmt.Sprintf("%d drafts rendered", s.draftCount)
+ }
+
+ if viper.GetBool("BuildDrafts") {
+ return fmt.Sprintf("%d of ", s.draftCount) + msg
+ }
+
+ return "0 of " + msg
+}
+
+func (s *Site) futureStats() string {
+ var msg string
+
+ switch s.futureCount {
+ case 0:
+ return "0 future content "
+ case 1:
+ msg = "1 future rendered "
+ default:
+ msg = fmt.Sprintf("%d future rendered", s.draftCount)
+ }
+
+ if viper.GetBool("BuildFuture") {
+ return fmt.Sprintf("%d of ", s.futureCount) + msg
+ }
+
+ return "0 of " + msg
+}