When building my Hugo site with CloudCannon, I noticed npx @bookshop/generate could not find any pages that referenced a (custom) Bookshop component. My site did have a few test pages that referenced such a component. After some debugging, I noticed the following line was scanning the built HTML files for an HTML comment:
As it turns out, the --minify flag (which I had enabled in the CloudCannon build configuration / command line options) was purging all HTML comments from the output files. Adjusting the Hugo minify configuration fixed the issue and enabled the visual editing of the Bookshop component. I added the following configuration to hugo.toml:
I prepared a small revision to the Hugo docs to help others who might encounter similar issues. To keep it concise, I linked to the Hugo docs only. Feel free to share your comments about this PR.
Thanks for the PR! Yes, this is something that should be better documented — I'll merge this and look to document it for the other relevant SSGs 🙂
When building my Hugo site with CloudCannon, I noticed
npx @bookshop/generate
could not find any pages that referenced a (custom) Bookshop component. My site did have a few test pages that referenced such a component. After some debugging, I noticed the following line was scanning the built HTML files for an HTML comment:https://github.com/CloudCannon/bookshop/blob/6010d46d810d786d5c089980130759e4637546e6/javascript-modules/generate/lib/live-connector.js#L67
As it turns out, the
--minify
flag (which I had enabled in the CloudCannon build configuration / command line options) was purging all HTML comments from the output files. Adjusting the Hugo minify configuration fixed the issue and enabled the visual editing of the Bookshop component. I added the following configuration tohugo.toml
:I prepared a small revision to the Hugo docs to help others who might encounter similar issues. To keep it concise, I linked to the Hugo docs only. Feel free to share your comments about this PR.