Replace deprecated site.Data with hugo.Data in tests

This also fixes a subtle server reload issue when changing files inside /data and using the recently added hugo.Data method.
This commit is contained in:
Bjørn Erik Pedersen
2026-03-21 19:09:14 +01:00
parent 182b104571
commit a8fca598e6
8 changed files with 29 additions and 18 deletions
+11
View File
@@ -20,6 +20,8 @@ import (
"github.com/gohugoio/hugo/common/hstore"
"github.com/gohugoio/hugo/common/hugo"
"github.com/gohugoio/hugo/common/version"
"github.com/gohugoio/hugo/identity"
"github.com/gohugoio/hugo/resources/page/siteidentities"
)
var _ hstore.StoreProvider = (*HugoInfo)(nil)
@@ -114,6 +116,15 @@ func (i HugoInfo) IsMultilingual() bool {
return i.opts.Conf.IsMultilingual()
}
// For internal use.
func (s HugoInfo) ForEeachIdentityByName(name string, f func(identity.Identity) bool) {
if id, found := siteidentities.FromString(name); found {
if f(id) {
return
}
}
}
// HugoInfoConfigProvider represents the config options that are relevant for HugoInfo.
type HugoInfoConfigProvider interface {
Environment() string