Ejemplo n.º 1
0
// generateHTMLFromMarkdown() generates the HTML of the given post object and stores it in the file denoted by 'postDstPath'.
func generatePostHTML(p *post.BPost, postDstPath string, viewBuilder *view.Builder) error {
	// create the actual HTML file for the post
	bundle := &view.TemplateBundle{
		Footer: &view.FooterStruct{Year: time.Now().Year(), Post: p},
		Header: &view.HeaderStruct{Title: p.Title, Post: p},
		Post:   p,
	}
	return viewBuilder.RenderToPath(postDstPath, view.LAYOUT_POST, bundle)
}
Ejemplo n.º 2
0
func generateIndexHTML(b *SiteBundle, viewBuilder *view.Builder) error {
	sort.Sort(post.ByDate(b.Posts))
	// create the actual HTML file for the post
	bundle := &view.TemplateBundleIndex{
		Footer: &view.FooterStruct{Year: time.Now().Year()},
		Header: &view.HeaderStruct{Title: b.SiteIndexTitle},
		Posts:  b.Posts,
	}
	return viewBuilder.RenderToPath(filepath.Join(b.SiteDst, "index.html"), view.LAYOUT_INDEX, bundle)
}