Hugo theme broken with CORS policy errors

I’ve been running this site with the hugo blackburn theme on netlify for a few years. It “just worked,” but I needed to change so I switched to the anatole theme which has created problems with netlify it seems. The first error on the page is

Access to CSS stylesheet at'  from origin' has been blocked by CORS policy: 
No  Access-Control-Allow-Origin header is present on the requested resource

To fix the error I have followed the guidance in the relevant support docs. I made the theme a git submodule and created a netlify.toml file in the root directory that looks like the sample netlify provides the the addition of these lines. the deploy log shows the file was found.

  for = "/*"
    Access-Control-Allow-Origin = "*"

No errors appear on the locally hosted site. I appreciate any help. Thanks.

Netlify switched from .com to .app subdomains sometime back in 2020 I suppose. So I think you need to change the .com domain to .app in your config.toml.

The better option would be to edit the theme and change all {{ .Permalink }} to {{ .RelPermalink }}.

1 Like

O.M.G. So much hair pulling. So many hours fiddling and tweaking. But I missed this. All I had to do was change three letters in the first line of the config.toml file. Ugh.