package versions

import "github.com/gohugoio/hugo/hugolib/versions"

Index

Functions

func DecodeConfig

func DecodeConfig(defaultContentVersion string, m map[string]any) (*config.ConfigNamespace[map[string]VersionConfig, VersionsInternal], error)

Types

type Version

type Version interface {
	Name() string
}

func NewVersion

func NewVersion(v VersionInternal) Version

type VersionConfig

type VersionConfig struct {
	// The weight of the version.
	// Used to determine the order of the versions.
	// If zero, we use the version name to sort.
	Weight int
}

type VersionInternal

type VersionInternal struct {
	// Name of the version.
	// This is the key from the config.
	Name string
	// Whether this version is the default version.
	// This will be by default rendered in the root.
	// There can only be one default version.
	Default bool

	VersionConfig
}

type Versions

type Versions []Version

type VersionsInternal

type VersionsInternal struct {
	Sorted []VersionInternal
	// contains filtered or unexported fields
}

func (VersionsInternal) ForEachIndex

func (r VersionsInternal) ForEachIndex() iter.Seq[int]

ForEachIndex returns an iterator for the indices of the versions.

func (VersionsInternal) Has

func (r VersionsInternal) Has(version string) bool

func (VersionsInternal) IndexDefault

func (r VersionsInternal) IndexDefault() int

func (VersionsInternal) IndexMatch

func (r VersionsInternal) IndexMatch(match predicate.P[string]) (iter.Seq[int], error)

IndexMatch returns an iterator for the versions that match the filter.

func (VersionsInternal) Len

func (r VersionsInternal) Len() int

func (VersionsInternal) ResolveIndex

func (r VersionsInternal) ResolveIndex(name string) int

func (VersionsInternal) ResolveName

func (r VersionsInternal) ResolveName(i int) string

Source Files

versions.go

Version
v0.153.4 (latest)
Published
Dec 28, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
4 months ago

Tools for package owners.