Documentation ¶
Overview ¶
Package html maps your filesystem to `html/template` and handles templates.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer holds settings and config to Render with
func NewRenderer ¶
func NewRenderer(settings *Settings, plugins []Plugin, log logrus.FieldLogger) *Renderer
NewRenderer returns a new instance of Renderer
func (*Renderer) Render ¶
Render calls RenderWithLayout with the default layoutName from html.Settings.LayoutName
func (*Renderer) RenderWithLayout ¶
func (renderer *Renderer) RenderWithLayout(layoutName, templateName string, layoutData interface{}) ([]byte, error)
RenderWithLayout renders the given templateName with the given layoutName and data It finds the templates within the given html.Settings.TemplatePath.
Default template functions are provided in addition to the plugin template functions. See https://github.com/s12chung/gostatic/blob/master/go/lib/html/helpers.go for a list of default helper functions.
type Scratch ¶
type Scratch struct {
M map[string]interface{}
}
Scratch is a struct holding temp data, inspired by: https://gohugo.io/functions/scratch
type Settings ¶
type Settings struct { TemplatePath string `json:"template_path,omitempty"` TemplateExt string `json:"template_ext,omitempty"` LayoutName string `json:"layoutName,omitempty"` WebsiteTitle string `json:"website_title,omitempty"` }
Settings represents the settings of the HTML templates
func DefaultSettings ¶
func DefaultSettings() *Settings
DefaultSettings is the default settings of the HTML templates