I’ve just hit this weird problem when trying to update one of my sites, which I haven’t made any changes to for about 6 months [so presumably it was built with an older version of Hugo].
If I run the old stylee hugo server --watch --renderToDisk
command, the site seems to build OK, but certain elements like embedded fonts don’t render [I get a CORS error in the browser console:
Access to Font at 'https://madra.net/fonts/opensans.ttf' from origin 'http://localhost:1313' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:1313' is therefore not allowed access.
which is odd, as surely Hugo shouldn’t be looking for site elements such as fonts at the ‘production’ URL when building locally? I don’t get this error and embedded fonts display properly in another site with a very similar setup but which has been updated more recently.
Additionally, no changes I make to the page I’m working on are reflected when the site is rebuilt. Hugo detects the page has been updated and claims to have rebuilt the page, but the content doesn’t change
Change detected, rebuilding site
2018-02-07 19:01:10.792 +0000
Source changed "/Users/madra/Sites/madra.net/content/shop.md": CREATE
Total in 16 ms
If I use the newer stylee hugo server --disableFastRender
then every page on the site apart from the index returns a 404 page not found
error.
As with running hugo server --watch --renderToDisk
above, making changes to the page triggers a rebuild and Hugo shows no error but the pages don’t get built - 404
for anything which isn’t the index page.
Change detected, rebuilding site
2018-02-07 19:13:20.793 +0000
Source changed "/Users/madra/Sites/madra.net/content/shop.md": CREATE
Total in 17 ms
This sounds very similar to a problem mentioned by @rickymetz in another thread and @billthefarmer also seems to have been afflicted with build errors using a newer version of Hugo
In the past, I’ve had the odd error and needed to make the odd code tweak, after an update to Hugo. But these were usually flagged up by the output from hugo server
. In this case I’m getting no error from hugo server
but the pages are either; not being updated or not being built at all --depending on which flag I use with the server
command.
So, is there a breaking change in a recent update, affecting static pages, which I should be aware of? And, if so, how do I fix it?