Lednerb / bilberry-hugo-theme

Premium theme for the hugo site builder. DEMO:
https://lednerb.github.io/bilberry-hugo-theme/
MIT License
355 stars 151 forks source link

Multilingual sites on different domains don't load JavaScript and CSS #627

Closed Magneticdud closed 7 months ago

Magneticdud commented 7 months ago

On v4, there's the integrity check on theme.css and theme.js

As I wrote on this discussion, I found out that secondary language sites hosted on separate domains won't load the content of those three files, breaking the site.

On the browser console, it says three errors like

Subresource Integrity: The resource 'https://www.example.com/theme.min.83a50f6….js' has an integrity attribute, but the resource requires the request to be CORS enabled to check the integrity, and it is not. The resource has been blocked because the integrity cannot be enforced.

I enabled the CORS header on the server but no browser rendered that. It seems like that, according to this documentation an additional crossorigin="anonymous" parameter is needed.

I created a pull request for this.

Now, maybe a better approach is to have those three files linking to the baseURL of the specific language, but I have no idea to do that. I tried to fiddle using .Site.BaseURL but I wasn't able to get that cache-busting string after the filename.

igor-baiborodine commented 7 months ago

Fixed in PR https://github.com/Lednerb/bilberry-hugo-theme/pull/628.