mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 07:18:54 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user