Documentation ¶
Overview ¶
Package partials provides template functions for working with reusable templates.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TestTemplateProvider deps.ResourceProvider
TestTemplateProvider is global deps.ResourceProvider. NOTE: It's currently unused.
Functions ¶
This section is empty.
Types ¶
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace provides template functions for the "templates" namespace.
func (*Namespace) Include ¶
Include executes the named partial. If the partial contains a return statement, that value will be returned. Else, the rendered output will be returned: A string if the partial is a text/template, or template.HTML when html/template. Note that ctx is provided by Hugo, not the end user.
func (*Namespace) IncludeCached ¶ added in v0.30.1
func (ns *Namespace) IncludeCached(ctx context.Context, name string, context any, variants ...any) (any, error)
IncludeCached executes and caches partial templates. The cache is created with name+variants as the key. Note that ctx is provided by Hugo, not the end user.