helper

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathSpec

type PathSpec struct {
	RootURL string
}

func NewPathSpec

func NewPathSpec(rootURL string) *PathSpec

func (*PathSpec) MakePath

func (p *PathSpec) MakePath(s string) string

MakePath takes a string with any characters and replace it so the string could be used in a path. It does so by creating a Unicode-sanitized string, with the spaces replaced, whilst preserving the original casing of the string. E.g. Social Media -> Social-Media

func (*PathSpec) MakePathSanitized

func (p *PathSpec) MakePathSanitized(s string) string

MakePathSanitized creates a Unicode-sanitized string, with the spaces replaced

func (*PathSpec) URLEscape

func (p *PathSpec) URLEscape(uri string) string

URLEscape escapes unicode letters.

func (*PathSpec) URLize

func (p *PathSpec) URLize(uri string) string

URLize is similar to MakePath, but with Unicode handling Example:

uri: Vim (text editor)
urlize: vim-text-editor

func (*PathSpec) UnicodeSanitize

func (p *PathSpec) UnicodeSanitize(s string) string

UnicodeSanitize sanitizes string to be used in Hugo URL's, allowing only a predefined set of special Unicode characters. If RemovePathAccents configuration flag is enabled, Unicode accents are also removed. Hyphens in the original input are maintained. Spaces will be replaced with a single hyphen, and sequential replacement hyphens will be reduced to one

Jump to

Keyboard shortcuts

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