permalink

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsLiquidTags

func ContainsLiquidTags(s string) bool

ContainsLiquidTags returns true if the string contains {{ }} Liquid expressions.

func DefaultFromPath

func DefaultFromPath(relPath string) string

DefaultFromPath computes the default URL from a content file's relative path.

func Resolve

func Resolve(pattern string, page *content.Page, renderers ...PermalinkRenderer) (string, error)

Resolve computes the output URL for a page using config patterns and front matter overrides. When a front matter permalink contains {{ }}, it is rendered through the provided renderer. Token syntax and template syntax are mutually exclusive — when {{ is detected, tokens like :year and :slug are not resolved.

func ResolveAliases

func ResolveAliases(page *content.Page) ([]string, error)

ResolveAliases returns all alias output paths for a page, as specified in the page's front matter "aliases" list. These are additional output locations for the same rendered content — not redirects.

func ResolveFromCascade

func ResolveFromCascade(page *content.Page, cascadeData map[string]interface{}, renderers ...PermalinkRenderer) (string, error)

ResolveFromCascade computes the output URL for a page using permalink patterns from the _data.yaml cascade. The lookup order is:

  1. Front matter permalink (static or template)
  2. Cascade "permalink" pattern from _data.yaml (supports both tokens and templates)
  3. File path default (DefaultFromPath)

func ResolveTokens

func ResolveTokens(pattern string, page *content.Page) string

ResolveTokens performs fast token replacement on a permalink pattern.

Types

type PermalinkRenderer added in v0.4.0

type PermalinkRenderer func(source string, ctx map[string]interface{}) (string, error)

PermalinkRenderer renders a template permalink string with a page context.

Jump to

Keyboard shortcuts

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