Add site.Store and hugo.Store and Shortcode.Store

Closes #13021
This commit is contained in:
Bjørn Erik Pedersen
2024-11-13 11:07:32 +01:00
parent 3477d9fcec
commit a7df536a52
7 changed files with 108 additions and 13 deletions

View File

@@ -22,7 +22,13 @@ import (
"github.com/gohugoio/hugo/common/math"
)
// Scratch is a writable context used for stateful operations in Page/Node rendering.
type StoreProvider interface {
// Store returns a Scratch that can be used to store temporary state.
// Store is not reset on server rebuilds.
Store() *Scratch
}
// Scratch is a writable context used for stateful build operations
type Scratch struct {
values map[string]any
mu sync.RWMutex