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

When hosting on github the theme is not rendered correctly. #89

Closed
MariosKaramanis opened this issue Nov 27, 2020 · 17 comments
Closed

When hosting on github the theme is not rendered correctly. #89

MariosKaramanis opened this issue Nov 27, 2020 · 17 comments
Labels
bug Something isn't working resolved Resolved Issue/Question

Comments

@MariosKaramanis
Copy link

I have the following code:

https://github.com/MariosKaramanis?tab=repositories

Here you can see the two repositories I am using.
marioskaramanis.github.io contains the public contents after running hugo -t PaperMod

and marioskaramanis-blog contains the files I used to build the hugo website.

When I run the code locally using hugo server I am getting the desired format: https://prnt.sc/vqxj5j
but when I host it in github, I am getting this: https://marioskaramanis.github.io/

I checked my yaml file and there is a correct mapping between the baseUrl and the host url.

It seems that it does not find the css correctly or I am missing some configurations. Could you please help me out?

Thanks a lot!

@adityatelange
Copy link
Owner

@MariosKaramanis add proper baseURL
https://github.com/MariosKaramanis/marioskaramanis-blog/blob/main/config.yml#L1

baseURL: "https://marioskaramanis.github.io/"

@adityatelange adityatelange added the resolved Resolved Issue/Question label Nov 27, 2020
@MariosKaramanis
Copy link
Author

MariosKaramanis commented Nov 27, 2020

This is what I had in the beginning and it didn't work. I will try tomorrow again and let you know.

But also the local index.html file that is generated by hugo, gives the same result:

image

@adityatelange
Copy link
Owner

adityatelange commented Nov 27, 2020

This is what I had in the beginning and it didn't work. I will try tomorrow again and let you know.

I see you had baseURL: "http://marioskaramanis.github.io" it should be https rather than http.

@MariosKaramanis
Copy link
Author

MariosKaramanis commented Nov 27, 2020

I can't try on github right now I promise I will do tomorrow and let you know.

But the local index.html file that is generated in the public folder gives again the same undesired result. I tried both hugo and hugo -t PaperMod

@MariosKaramanis
Copy link
Author

I just updated both files. I added the baseUrl as you mentioned: https://github.com/MariosKaramanis/marioskaramanis-blog/blob/main/config.yml

Then I built the project with hugo -t PaperMod, and then I updated the files of the website repository

Again it does not work :(

@MariosKaramanis
Copy link
Author

You see all the codes. How is it possible that it does not work ? I followed exactly the instructions. I am not complaining. I just asked a question. If you don't know the answer it is totally fine.

Btw I just posted a question on stackoverflow: https://stackoverflow.com/questions/65040931/hugo-site-renders-locally-but-not-on-github

@adityatelange
Copy link
Owner

adityatelange commented Nov 28, 2020

@MariosKaramanis You should look at what the error is, instead asking me to find out the error !

Have you seen the error in your browser dev tools ? console..!? ig not

DEMO is itself hosted on github pages !

@adityatelange adityatelange added discussion discussion about anything related and removed resolved Resolved Issue/Question labels Nov 28, 2020
@MariosKaramanis
Copy link
Author

MariosKaramanis commented Nov 28, 2020

Please check the errors in the update section of my question:
https://stackoverflow.com/questions/65040931/hugo-site-renders-locally-but-not-on-github

image

@adityatelange
Copy link
Owner

adityatelange commented Nov 28, 2020

@MariosKaramanis

Read
https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity#How_browsers_handle_Subresource_Integrity

This is what papermod uses by default

<!-- Styles -->
{{- $stylesheet := (resources.Match "css/*.css") | resources.Concat "assets/css/stylesheet.css" | minify | fingerprint -}}
<link href="{{ $stylesheet.Permalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet"
as="style">

your resource file conflicts with generated hash by hugo, thus browser denies loading it as per the rule !


what you can do is rm your whole gh pages repo and rebuild it/ re deploy it !

@MariosKaramanis
Copy link
Author

MariosKaramanis commented Nov 28, 2020

if I replace integrity="{{ $stylesheet.Data.Integrity }}" with integrity="" it will work right?

Because I just replaced manually from every index.html file with integrity="" and it worked!

removing and redeploy does not make sense since I have done it at least 5 times so far. Like I said, removing the integrity part worked. Could you please confirm that?

@MariosKaramanis
Copy link
Author

MariosKaramanis commented Nov 28, 2020

I confirm my last comment. It worked ! Thanks for all your help!

adityatelange added a commit that referenced this issue Dec 1, 2020
in site config =>
    params:
      assets:
        disableFingerprinting: true
@adityatelange
Copy link
Owner

Hey @MariosKaramanis,
I have added an option to disable Fingerprinting, just in case someone in future has the same issue !

adityatelange added a commit that referenced this issue Dec 1, 2020
@adityatelange adityatelange added bug Something isn't working resolved Resolved Issue/Question and removed discussion discussion about anything related labels Dec 1, 2020
@MariosKaramanis
Copy link
Author

Thanks, I am sure this will benefit some future readers. Thanks for the theme and for your help.

@1a57danc3
Copy link

This bug still exists.

@labeveryday
Copy link

Yes this is still an issue. If you do this fix before sure to clear your cache. lxndrblz/anatole#114 (comment)

@birdpump
Copy link

birdpump commented Sep 8, 2022

issue still exists but removing setting integrity="" works

kylethedeveloper pushed a commit to kylethedeveloper/hugo-PaperMod that referenced this issue Feb 21, 2023
kylethedeveloper pushed a commit to kylethedeveloper/hugo-PaperMod that referenced this issue Feb 21, 2023
in site config =>
    params:
      assets:
        disableFingerprinting: true
@thatfrozenfrog
Copy link

Holy cow 2023 and it's still a prevailing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved Resolved Issue/Question
Projects
None yet
Development

No branches or pull requests

6 participants