package urls

import "github.com/gohugoio/hugo/tpl/urls"

Package urls provides template functions to deal with URLs.

Index

Package Files

init.go urls.go

type Namespace

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

Namespace provides template functions for the "urls" namespace.

func New

func New(deps *deps.Deps) *Namespace

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

func (*Namespace) AbsLangURL

func (ns *Namespace) AbsLangURL(s any) (template.HTML, error)

AbsLangURL the string s and converts it to an absolute URL according to a page's position in the project directory structure and the current language.

func (*Namespace) AbsURL

func (ns *Namespace) AbsURL(s any) (template.HTML, error)

AbsURL takes the string s and converts it to an absolute URL.

func (*Namespace) Anchorize

func (ns *Namespace) Anchorize(s any) (string, error)

Anchorize creates sanitized anchor name version of the string s that is compatible with how your configured markdown renderer does it.

func (*Namespace) Parse

func (ns *Namespace) Parse(rawurl any) (*url.URL, error)

Parse parses rawurl into a URL structure. The rawurl may be relative or absolute.

func (*Namespace) Ref

func (ns *Namespace) Ref(p any, args any) (template.HTML, error)

Ref returns the absolute URL path to a given content item from Page p.

func (*Namespace) RelLangURL

func (ns *Namespace) RelLangURL(s any) (template.HTML, error)

RelLangURL takes the string s and prepends the relative path according to a page's position in the project directory structure and the current language.

func (*Namespace) RelRef

func (ns *Namespace) RelRef(p any, args any) (template.HTML, error)

RelRef returns the relative URL path to a given content item from Page p.

func (*Namespace) RelURL

func (ns *Namespace) RelURL(s any) (template.HTML, error)

RelURL takes the string s and prepends the relative path according to a page's position in the project directory structure.

func (*Namespace) URLize

func (ns *Namespace) URLize(s any) (string, error)

URLize returns the the strings s formatted as an URL.

Version
v0.101.0 (latest)
Published
Jun 16, 2022
Platform
linux/amd64
Imports
8 packages (graph)
Last checked
3 hours ago

Tools for package owners.