mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Fix regression with site.IsServer when not running a server
Fixes #11006
This commit is contained in:
@@ -185,7 +185,7 @@ func (h *HugoSites) initRebuild(config *BuildCfg) error {
|
||||
return errors.New("rebuild does not support 'ResetState'")
|
||||
}
|
||||
|
||||
if !h.Configs.Base.Internal.Running {
|
||||
if !h.Configs.Base.Internal.Watch {
|
||||
return errors.New("rebuild called when not in watch mode")
|
||||
}
|
||||
|
||||
|
@@ -327,6 +327,7 @@ func (s *IntegrationTestBuilder) initBuilder() error {
|
||||
if s.Cfg.Running {
|
||||
flags.Set("internal", maps.Params{
|
||||
"running": s.Cfg.Running,
|
||||
"watch": s.Cfg.Running,
|
||||
})
|
||||
}
|
||||
|
||||
|
@@ -583,7 +583,7 @@ var defaultRenderStringOpts = renderStringOpts{
|
||||
}
|
||||
|
||||
func (p *pageState) addDependency(dep identity.Provider) {
|
||||
if !p.s.running() || p.pageOutput.cp == nil {
|
||||
if !p.s.watching() || p.pageOutput.cp == nil {
|
||||
return
|
||||
}
|
||||
p.pageOutput.cp.dependencyTracker.Add(dep)
|
||||
|
@@ -76,7 +76,7 @@ func newPageContentOutput(p *pageState, po *pageOutput) (*pageContentOutput, err
|
||||
parent := p.init
|
||||
|
||||
var dependencyTracker identity.Manager
|
||||
if p.s.running() {
|
||||
if p.s.watching() {
|
||||
dependencyTracker = identity.NewManager(pageContentOutputDependenciesID)
|
||||
}
|
||||
|
||||
|
@@ -389,8 +389,8 @@ func (s *siteRefLinker) refLink(ref string, source any, relative bool, outputFor
|
||||
return link, nil
|
||||
}
|
||||
|
||||
func (s *Site) running() bool {
|
||||
return s.h != nil && s.h.Configs.Base.Internal.Running
|
||||
func (s *Site) watching() bool {
|
||||
return s.h != nil && s.h.Configs.Base.Internal.Watch
|
||||
}
|
||||
|
||||
type whatChanged struct {
|
||||
@@ -1064,7 +1064,7 @@ func (s *Site) renderAndWritePage(statCounter *uint64, name string, targetPath s
|
||||
pd.AbsURLPath = s.absURLPath(targetPath)
|
||||
}
|
||||
|
||||
if s.running() && s.conf.Internal.Watch && !s.conf.Internal.DisableLiveReload {
|
||||
if s.watching() && s.conf.Internal.Watch && !s.conf.Internal.DisableLiveReload {
|
||||
pd.LiveReloadBaseURL = s.Conf.BaseURLLiveReload().URL()
|
||||
}
|
||||
|
||||
|
@@ -280,7 +280,7 @@ func newHugoSitesNew(cfg deps.DepsCfg, d *deps.Deps, sites []*Site) (*HugoSites,
|
||||
}
|
||||
|
||||
// Only needed in server mode.
|
||||
if cfg.Configs.Base.Internal.Running {
|
||||
if cfg.Configs.Base.Internal.Watch {
|
||||
h.ContentChanges = &contentChangeMap{
|
||||
pathSpec: h.PathSpec,
|
||||
symContent: make(map[string]map[string]bool),
|
||||
|
@@ -486,6 +486,7 @@ func (s *sitesBuilder) LoadConfig() error {
|
||||
flags := config.New()
|
||||
flags.Set("internal", map[string]any{
|
||||
"running": s.running,
|
||||
"watch": s.running,
|
||||
})
|
||||
|
||||
if s.workingDir != "" {
|
||||
|
Reference in New Issue
Block a user