package urls

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

Index

Types

type BaseURL

type BaseURL struct {
	WithPath    string
	WithoutPath string
	BasePath    string
	// contains filtered or unexported fields
}

A BaseURL in Hugo is normally on the form scheme://path, but the form scheme: is also valid (mailto:hugo@rules.com).

func NewBaseURLFromString

func NewBaseURLFromString(b string) (BaseURL, error)

func (BaseURL) HostURL

func (b BaseURL) HostURL() string

HostURL returns the URL to the host root without any path elements.

func (BaseURL) Path

func (b BaseURL) Path() string

func (BaseURL) Port

func (b BaseURL) Port() int

func (BaseURL) String

func (b BaseURL) String() string

func (BaseURL) URL

func (b BaseURL) URL() *url.URL

URL returns a copy of the internal URL. The copy can be safely used and modified.

func (BaseURL) WithPort

func (b BaseURL) WithPort(port int) (BaseURL, error)

func (BaseURL) WithProtocol

func (b BaseURL) WithProtocol(protocol string) (BaseURL, error)

WithProtocol returns the BaseURL prefixed with the given protocol. The Protocol is normally of the form "scheme://", i.e. "webcal://".

type RefLinker

type RefLinker interface {
	Ref(args map[string]any) (string, error)
	RelRef(args map[string]any) (string, error)
}

RefLinker is implemented by those who support reference linking. args must contain a path, but can also point to the target language or output format.

Source Files

baseURL.go ref.go

Version
v0.112.4
Published
May 28, 2023
Platform
linux/amd64
Imports
4 packages
Last checked
3 hours ago

Tools for package owners.