package segments

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

Index

Functions

func DecodeSegments

func DecodeSegments(in map[string]any) (*config.ConfigNamespace[map[string]SegmentConfig, Segments], error)

Types

type SegmentConfig

type SegmentConfig struct {
	Excludes []SegmentMatcherFields
	Includes []SegmentMatcherFields
}

type SegmentFilter

type SegmentFilter interface {
	// ShouldExcludeCoarse returns whether the given fields should be excluded on a coarse level.
	ShouldExcludeCoarse(SegmentMatcherFields) bool

	// ShouldExcludeFine returns whether the given fields should be excluded on a fine level.
	ShouldExcludeFine(SegmentMatcherFields) bool
}

type SegmentMatcherFields

type SegmentMatcherFields struct {
	Kind   string
	Path   string
	Lang   string
	Output string
}

SegmentMatcherFields is a matcher for a segment include or exclude. All of these are Glob patterns.

type Segments

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

Segments is a collection of named segments.

func (Segments) Get

func (sms Segments) Get(onNotFound func(s string), ss ...string) SegmentFilter

Get returns a SegmentFilter for the given segments.

Source Files

segments.go

Version
v0.144.2 (latest)
Published
Feb 19, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
13 hours ago

Tools for package owners.