attributes

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

Creates a new Namespace and returns a new internal.FuncsNamespace

Types

type Namespace

type Namespace struct {
	// contains filtered or unexported fields
}

Namespace defines the methods for attributes to be used as template functions.

func New

Creates a new attributes Namespace

func (*Namespace) Body

func (ns *Namespace) Body() string

Body

Returns class names for the body element. Includes the resource, page ID, page title, page template, page layout and if the user is logged in or not.

Example: `{{ body }}` Returns: `page page-id-4 page-title page-template-news-archive page-layout-main logged-in` (for example)

func (*Namespace) Homepage

func (ns *Namespace) Homepage() bool

Homepage

Returns true if the post is the homepage.

Example: `{{ if homepage }} <h2>Hello</h2> {{ end }}` Returns: '<h2>Hello</h2>` (for example)

func (*Namespace) Lang

func (ns *Namespace) Lang() string

Lang

Returns language attributes set in the options for use with the `<html lang="">` attribute.

Example: `{{ lang }}` Returns: 'en-gb` (for example)

Jump to

Keyboard shortcuts

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