wangchucheng / hugo-eureka

Eureka is a feature-rich and highly customizable Hugo theme.
https://www.wangchucheng.com/en/docs/hugo-eureka/
Apache License 2.0
920 stars 192 forks source link

Cannot load stylesheet, Failed integrity metadata check #180

Closed ecthrwatch closed 2 years ago

ecthrwatch commented 2 years ago

UPDATE: if in layouts/partials/head.html I change $eurekaCSS.Permalink To $eurekaCSS.RelPermalink | absLangURL It seems to work. It might be related to Hugo: https://github.com/gohugoio/hugo/issues/8109

Here is what my languages.yaml looks like:

en: languageCode: en languageName: English title: Nicholas Burns (non-official) contentDir: content/en baseURL: 'https://nicholas-burns.united-states-of-america.eu'

fr: languageCode: fr languageName: French - Français title: Nicholas Burns (non officiel) contentDir: content/fr baseURL: 'https://nicholas-burns.etats-unis.eu'

zh: languageCode: zh languageName: Chinese - 简体中文 title: Nicholas Burns (非官方网站) contentDir: content/zh baseURL: 'https://nicholas-burns.meiguo.eu'

Describe the bug

When I visit

https://nicholas-burns.united-states-of-america.eu

the page loads normally. The stylesheet is properly loaded from this link:

https://nicholas-burns.united-states-of-america.eu/css/eureka.min.6a378a23360d238dc3ef4df2f5cd718093f02c10c9c7eb2437c29701cd8d389ab6da5d9f21bdd3afa305fd56c1235017.css

But if I visit the French version of the website

https://nicholas-burns.etats-unis.eu

it fails. It cannot load the stylesheet due to a failed integrity metadata check. I noted that it also points to this link:

https://nicholas-burns.united-states-of-america.eu/css/eureka.min.6a378a23360d238dc3ef4df2f5cd718093f02c10c9c7eb2437c29701cd8d389ab6da5d9f21bdd3afa305fd56c1235017.css

Expected behavior

If I visit the French version, it should point to the correct baseURL as defined in languages.yaml which is https://nicholas-burns.etats-unis.eu for the French version.

Screenshots

Screen Shot 2022-04-05 at 23 21 28

Environment

ecthrwatch commented 2 years ago

I think this issue might have to be reopened.

1) I am not sure to remove: integrity="{{ $eurekaCSS.Data.Integrity }}" is the right solution.

2) I don't know anything about Hugo. However, in "head.html", I tried to change

to

and it worked!

So, instead of $eurekaCSS.Permalink, use $eurekaCSS.RelPermalink | absLangURL?

You can read more about this here: https://github.com/gohugoio/hugo/issues/8109#issuecomment-757490873

What do you think wangchucheng?

wangchucheng commented 2 years ago

What is your "tried to change to "? It seems that something were missing.

I did not test what would happen if the site were hosted in different domains, so you may be true and I will have a look at it later.

ecthrwatch commented 2 years ago

Sorry, I posted code directly, I didn't pay attention. I am not use to comment on GitHub.

`

{{- $eurekaJS := resources.Get "js/eureka.js" | resources.ExecuteAsTemplate "js/eureka.js" . | minify | fingerprint "sha384" }}

`
ecthrwatch commented 2 years ago

It still doesn't show properly, here is a screenshot.

I was going to open a second ticket but I am going to post a another comment instead since I believe all of this might be related to the same issue. I am not certain whether it's a bug or not but I think it might be.

Screen Shot 2022-04-13 at 12 18 07
ecthrwatch commented 2 years ago

This is a similar problem. I hesitate whether I should open a second ticket or not. I will let you decide. There are 3 websites: Denise-Bauer.Meiguo.eu Denise-Bauer.Etats-Unis.eu Denise-Bauer.United-States-of-America.eu

Last night, I launched the first 2 but not the third one. The baseURL is set per language. Furthermore, I 1 distinct repo per hostname so that the Chinese version is hosted in China. The French version is hosted in France. The English version is hosted in the United States. There are multiple reasons why I decided to follow such a setting and I am not going to enter into too much details now.

So, after I launched the first 2 websites, the picture on the front page didn't load because it was trying to download the picture from Denise-Bauer.United-States-of-America.eu rather than Denise-Bauer.Meiguo.eu or Denise-Bauer.Etats-Unis.eu.

I am not sure if it's a bug or a mistake I made when I configure the website, but I believe it's in the same vein as the problem I previously mentioned.

What do you think?

Screen Shot 2022-04-13 at 12 22 03