Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change scss from .Permalink to .RelPermalink #133

Closed
my-yy opened this issue Jul 25, 2022 · 1 comment
Closed

Change scss from .Permalink to .RelPermalink #133

my-yy opened this issue Jul 25, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@my-yy
Copy link

my-yy commented Jul 25, 2022

Describe the bug
head.html
rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen".... rel="stylesheet" href="{{ $darkmode.Permalink }}" integrity="{{ $darkmode.Data.Integrity }}" media="screen"...

Avoid using .Permalink for integrity-guaranteed resources, which may cause the CORS issue.
For example, suppose the baseURL is https://www.ABC.com , when the user type https://ABC.com for a visit, they are most likely to encounter a CORS error:

Subresource Integrity: The resource 'https://www.abc.com/scss/journal.min.9ea79fa….css' 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.

Because the current host is ABC.com, which is not equal to www.ABC.com.

Also, if the user is running Hugo on a remote server, the preview mode will not be available. Because the host of the resource will be set as localhost, other than the domain name of the remote host.

Solution
Change .Permalink to .RelPermalink

@AmazingRise
Copy link
Owner

Hi my-yy
I decided to change all Permalink into RelPermalink. But I suggest you make a redirection from ABC.com to www.ABC.com or somewhat. The best practice is to make these two sites into one, in order to avoid some problems.
Thanks for your feedback.

@AmazingRise AmazingRise added the bug Something isn't working label Jul 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants