hugo -w detects template changes but doesn't rebuild usages of the template · Issue #12296 · gohugoio/hugo (original) (raw)

What version of Hugo are you using (hugo version)?

$ hugo version hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended darwin/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=brew

Does this issue reproduce with the latest release?

Yes.

What is the issue?

hugo -w will detect that a template has changed, but doesn't rebuild the pages that use it (leading to them still showing the old content).

To reproduce, the quickstart can be used. Add a page and a shortcode, i.e /content/hello.md and /layouts/shortcodes/hello.html.

/layouts/shortcodes/hello.html

/content/hello.md

Running hugo -w, there will be <p>Testing: Hello!</p> in /public/hello/index.html. Changing Hello! to Bye! in /layouts/shortcodes/hello.html will give you the following output from Hugo:

Change detected, rebuilding site (#1).
2024-03-22 13:17:12.022 +0000
Template changed /shortcodes/hello.html
Total in 46 ms

If we check /public/hello/index.html, it still says <p>Testing: Hello!</p>.

This is not an issue with hugo server, but our use-case is having Vite watch the /public/ directory and transform/serve the files for us so we rely on just hugo.

It can be worked around by just restarting the Hugo process if anything in /layouts/ changes, but I was wondering if it's a bug or expected behaviour.