hugo: Index | Files

package partials

import ""

Package partials provides template functions for working with reusable templates.


Package Files

init.go partials.go


var TestTemplateProvider deps.ResourceProvider

TestTemplateProvider is global deps.ResourceProvider. NOTE: It's currently unused.

type Namespace Uses

type Namespace struct {
    // contains filtered or unexported fields

Namespace provides template functions for the "templates" namespace.

func New Uses

func New(deps *deps.Deps) *Namespace

New returns a new instance of the templates-namespaced template functions.

func (*Namespace) Include Uses

func (ns *Namespace) Include(name string, contextList ...interface{}) (interface{}, error)

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.

func (*Namespace) IncludeCached Uses

func (ns *Namespace) IncludeCached(name string, context interface{}, variants ...interface{}) (interface{}, error)

IncludeCached executes and caches partial templates. The cache is created with name+variants as the key.

Package partials imports 15 packages (graph) and is imported by 44 packages. Updated 2020-09-15. Refresh now. Tools for package owners.