chipzoller / hugo-clarity

A theme for Hugo based on VMware Clarity
Other
571 stars 263 forks source link

[Bug] CORS error when using multilingual sites, .css and .js files not loading #395

Open manronES opened 1 year ago

manronES commented 1 year ago

I confirm:

Hugo version

hugo v0.104.3-58b824581360148f2d91f5cc83f69bd22c1aa331+extended linux/amd64 BuildDate=2022-10-04T14:25:23Z VendorInfo=gohugoio

Where is this bug showing up?

In the browser: Hugo builds the site, but something doesn't look right.

Operating system

Windows 10

Browser (if applicable)

Chrome 105

Current behavior

Multilingual setup, two languages defined with different domain names, "es" (weight 1, baseURL example.es) and "en" (weight 2, baseURL example.com.). No baseURL defined in main config.toml (in any case, similar behavior with "main" baseURL set to either domain)

example.com (EN site) won't show correctly, as CSS and JS files won't load due to CORS error (HREF URLs domain set to example.es instead of example.com)

Same issue as #375 (closed)

Expected behavior

References to CSS and JS should have the correct domain name (language's baseURL)

Steps to reproduce

Access alternate language site

Relevant log output

No response

Related code

layouts/partials/head.html, lines 31 and 39 ($styles.Permalink)

layouts/partials/search/scripts.html, line 11 ($bundle2.Permalink)

Preferred solution

No response

Other information

No response