Fix server refresh on 404 template changes

Fixes #13209
This commit is contained in:
Bjørn Erik Pedersen
2025-01-01 13:48:18 +01:00
parent 2db43f841c
commit d913f46a8b
2 changed files with 33 additions and 1 deletions

View File

@@ -14,6 +14,7 @@
package hugolib
import (
"fmt"
"testing"
)
@@ -82,3 +83,33 @@ Page not found
Base:
Page not found`)
}
func Test404EditTemplate(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
baseURL = "http://example.com/"
disableLiveReload = true
[internal]
fastRenderMode = true
-- layouts/_default/baseof.html --
Base: {{ block "main" . }}{{ end }}
-- layouts/404.html --
{{ define "main" }}
Not found.
{{ end }}
`
b := TestRunning(t, files)
b.AssertFileContent("public/404.html", `Not found.`)
b.EditFiles("layouts/404.html", `Not found. Updated.`).Build()
fmt.Println("Rebuilding")
b.BuildPartial("/does-not-exist")
b.AssertFileContent("public/404.html", `Not found. Updated.`)
}