aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-04-25 12:30:16 +0200
committerBjørn Erik Pedersen <[email protected]>2024-04-25 14:35:49 +0200
commit7203a95a6069b09a7546e5b2e286abe6455df83a (patch)
treeb61d582829a705f6eb47ba84ff697b656c5a79f6 /tpl
parentfb084390cd8f2f62220489b8f1692863f57b25b6 (diff)
downloadhugo-7203a95a6069b09a7546e5b2e286abe6455df83a.tar.gz
hugo-7203a95a6069b09a7546e5b2e286abe6455df83a.zip
Fix rebuilds when running hugo -w
This was partly broken in Hugo 0.123.0. We have two internal config options that gets set from the CLI: * Running; a web server is running * Watching; either set via `hugo -w` or `hugo server --watch=false` Part of the change detection code wrongly used the `Running` as a flag when `Watching` would be the correct. Fixes #12296
Diffstat (limited to 'tpl')
-rw-r--r--tpl/tplimpl/template_funcs.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/tpl/tplimpl/template_funcs.go b/tpl/tplimpl/template_funcs.go
index 9d14b9e56..e5ee4d54f 100644
--- a/tpl/tplimpl/template_funcs.go
+++ b/tpl/tplimpl/template_funcs.go
@@ -71,7 +71,7 @@ var (
)
type templateExecHelper struct {
- running bool // whether we're in server mode.
+ watching bool // whether we're in server/watch mode.
site reflect.Value
siteParams reflect.Value
funcs map[string]reflect.Value
@@ -95,7 +95,7 @@ func (t *templateExecHelper) GetFunc(ctx context.Context, tmpl texttemplate.Prep
}
func (t *templateExecHelper) Init(ctx context.Context, tmpl texttemplate.Preparer) {
- if t.running {
+ if t.watching {
_, ok := tmpl.(identity.IdentityProvider)
if ok {
t.trackDependencies(ctx, tmpl, "", reflect.Value{})
@@ -129,7 +129,7 @@ func (t *templateExecHelper) GetMethod(ctx context.Context, tmpl texttemplate.Pr
name = "MainSections"
}
- if t.running {
+ if t.watching {
ctx = t.trackDependencies(ctx, tmpl, name, receiver)
}
@@ -151,7 +151,7 @@ func (t *templateExecHelper) GetMethod(ctx context.Context, tmpl texttemplate.Pr
}
func (t *templateExecHelper) OnCalled(ctx context.Context, tmpl texttemplate.Preparer, name string, args []reflect.Value, result reflect.Value) {
- if !t.running {
+ if !t.watching {
return
}
@@ -238,7 +238,7 @@ func newTemplateExecuter(d *deps.Deps) (texttemplate.Executer, map[string]reflec
}
exeHelper := &templateExecHelper{
- running: d.Conf.Running(),
+ watching: d.Conf.Watching(),
funcs: funcsv,
site: reflect.ValueOf(d.Site),
siteParams: reflect.ValueOf(d.Site.Params()),