func t_meta_default(key string, dft interface{}, pg *page.Page) interface{} { if pg != nil { if v := pg.Meta(key); v != nil { return v } } return dft }
func (ctx *context) put_page(uri string, pg *page.Page) { if pg != nil { if err := ctx.app.pages.Put(uri, pg.GetData()); err != nil { ctx.Warn("context put (%s) page failed:(%s)", uri, err) } if err := ctx.app.pageIndexes.IndexIfNotExist(uri, pg.GetData()); err != nil { ctx.Warn("context index (%s) page failed:(%s)", uri, err) } } }
func t_tag_class(class string, pg *page.Page) []*html.Node { if pg != nil { return pg.TagClassAll(class) } return nil }
func t_tag_id(id string, pg *page.Page) []*html.Node { if pg != nil { return pg.TagIDAll(id) } return nil }
func t_tag(name string, pg *page.Page) []*html.Node { if pg != nil { return pg.TagNameAll(name) } return nil }
func t_markdown(pg *page.Page) template.HTML { if pg != nil { return template.HTML(pg.Markdown()) } return template.HTML("") }
func t_modify_datetime(pg *page.Page) time.Time { if pg != nil { return pg.ModifyDatetime() } return time.Time{} }
func t_meta(key string, pg *page.Page) interface{} { if pg != nil { return pg.Meta(key) } return nil }
func t_uri(pg *page.Page) string { if pg != nil { return pg.Meta("uri").(string) } return "" }
func t_summary(max int, pg *page.Page) string { return pg.Summary(max) }
func t_published_datetime(pg *page.Page) time.Time { return pg.PublishedDatetime() }
func t_title(pg *page.Page) string { return pg.Title() }