Documentation
¶
Overview ¶
Package template loads Go html/template files and renders pages with site data.
Package template loads Go html/template files and renders articles into HTML.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the concrete implementation of TemplateEngine. It loads html/template files from a theme directory and renders pages with site/article data.
func NewEngine ¶
func NewEngine() *Engine
NewEngine returns a new, empty Engine. Call Load before calling Render.
type TemplateEngine ¶
type TemplateEngine interface {
// Load parses all template files rooted at templateDir (e.g. theme/templates).
Load(templateDir string, funcs template.FuncMap) error
// Render executes the named template with the given data, writing the result
// to w. templateName corresponds to a file base name such as "article.html".
Render(w io.Writer, templateName string, data *model.Site) error
}
TemplateEngine loads theme templates from disk and renders pages using the standard library html/template package.
Click to show internal directories.
Click to hide internal directories.