url

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: 6 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 reflect to be used as template functions.

func New

Creates a new reflect Namespace

func (*Namespace) Base

func (ns *Namespace) Base() string

Base

Returns the current base url.

Example: {{ baseUrl }} Returns: `http://verbiscms.com` (for example)

func (*Namespace) Full

func (ns *Namespace) Full() string

Full

Returns the current full url

Example: {{ fullUrl }} Returns: `http://verbiscms.com/page` (for example)

func (*Namespace) Host

func (ns *Namespace) Host() string

Host

Returns the host of the current url

Example: {{ host }} Returns: `verbiscms.com` (for example)

func (*Namespace) Pagination

func (ns *Namespace) Pagination() int

Pagination

Gets the page query parameter and returns, if the page query param wasn't found or the string could not be cast to an integer, it will return 1.

Example: {{ paginationPage }}

func (*Namespace) Path

func (ns *Namespace) Path() string

Path

Returns the path of the current url

Example: {{ path }} Returns: `/page` (for example)

func (*Namespace) Query

func (ns *Namespace) Query(i interface{}) string

Query

Gets the page query parameter and returns, if the page query param wasn't found or the string could not be cast to an integer, it will return 1.

Example: {{ paginationPage }}

func (*Namespace) Scheme

func (ns *Namespace) Scheme() string

Scheme

Returns the scheme of the current url `http` or `https`

Example: {{ scheme }} Returns: `http` or `https` (for example)

Jump to

Keyboard shortcuts

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