content

package
v0.6.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2025 License: MIT Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	OfKey      = "contentOf"
	ForKey     = "contentFor"
	DefaultKey = "default"
)

Keys to be used in templates for the functions in this package.

Variables

This section is empty.

Functions

func ContentFor

func ContentFor(name string, help hctx.HelperContext)

ContentFor stores a block of templating code to be re-used later in the template via the contentOf helper. An optional map of values can be passed to contentOf, which are made available to the contentFor block.

<% contentFor("buttons") { %>
	<button>hi</button>
<% } %>

func ContentOf

func ContentOf(name string, data hctx.Map, help hctx.HelperContext) (template.HTML, error)

ContentOf retrieves a stored block for templating and renders it. You can pass an optional map of fields that will be set.

<%= contentOf("buttons") %>
<%= contentOf("buttons", {"label": "Click me"}) %>

func New

func New() hctx.Map

New returns a map of the helpers within this package.

func WithDefault added in v0.6.2

func WithDefault(key string, defaultValue interface{}, help hctx.HelperContext) interface{}

WithDefault returns the key if exists, otherwise it returns defaultValue passed.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL