gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
76.03k stars 7.54k forks source link

`watch` not working on custom output template #13014

Open razonyang opened 2 weeks ago

razonyang commented 2 weeks ago

Reproducer

// hugo.yaml
outputFormats:
  SearchIndex:
    baseName: 'Search'
    isPlainText: true
    mediaType: 'application/json'
    noAlternative: true

outputs:
  home:
    - HTML
    - SearchIndex
// layouts/_default/index.searchindex.json
{{ partial "index.json" . }}
// layouts/partials/index.json
{{ $data := dict
  "version" 1
}}
{{ jsonify $data }}

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

$ hugo version
hugo v0.137.0-59c115813595cba1b1c0e70b867e734992648d1b+extended linux/amd64 BuildDate=2024-11-04T16:04:06Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes. It was also present in earlier versions, such as 0.128.0.

bep commented 2 weeks ago

I'm pretty sure the issue title isn't true in general, so it must something ... special.

razonyang commented 2 weeks ago
  • What do you mean by watch? hugo server --watch?

Yes, hugo server --watch.

  • Do you have a complete and failing example living somewhere?

I just created a testing branch with the code snippets mentioned above.

git clone -b custom-output-watch git@github.com:razonyang/hugo-testing.git hugo-13014

cd hugo-13014

hugo server --watch -p 1111

And then I modified the layouts/partials/index.json, http://localhost:1111/search.json won't re-render until restarting Hugo server.

I can reproduce it on both Linux (as shown in the video I posted) and Windows.

ibuli commented 1 week ago

+1 This issue is also happening to me - the changes are not reflecting if change a particular file until we restart the server. Currently using hugo v0.114.0+extended darwin/arm64 BuildDate=unknown