gohugoio / hugo

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

Allow Watch Files List Customization for Hugo Server #10518

Closed hollowaykeanho closed 1 year ago

hollowaykeanho commented 1 year ago

As discussed in https://discourse.gohugo.io/t/customise-watch-files-list-for-hugo-server/41833, there is no way to customize the hugo server's watch files list when constructing a distributable Hugo Theme module.

Application

This is extremely useful for directory-driven content where the content, data, static files, page-spcific configs and etc. execution.

Why It Is Needed

While the input data files (e.g. configurations, data) uses the dot filename notation (e.g. .data.toml, .page.toml, .thumbnails.toml, etc) to tell Hugo not to copy them over to the output, they are not being watched for any changes.

Workaround

User will have to nudge _index.html to tell Hugo server to rebuild the site and capture the changes of these data files.

Attempted Methods

The module mounting method leveraging excludeFiles discussed in the forum linked above was attempted. However, this elimitates the source file entirely for parsing and rendering, thus, defeated the purpose.

Available references

Tested working (as theme user): https://github.com/ZORALab/Hestia/tree/experimental/docs/content/en/specifications/hestiaUI/blockquote_hestiaUI

Archetypes Example: https://github.com/ZORALab/Hestia/tree/experimental/hestiaHUGO/archetypes/hestia

bep commented 1 year ago

Is this we have plenty of ways to control how files are watched in Hugo, which I suspect is not your problem.

Have a look at https://gohugo.io/content-management/build-options/

Which would allow you to have data.toml etc. along-side your content but prevent it from being published.

Take further questions/discussions in the thread above. We're not adding some special configuration for the file watcher -- watching files is directly related to rebuilding, so we need to know what to do when a particular file changes.

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.