Hugo site works fine on netlify and on mac, but doesn´t work locally on windows

Hello!

I setup a site with theme hermit on netlify on my mac and everything works completely fine both in production and local.

I have cloned my repo and updated the submudolue aswell on my Windows PC, but for some reason my localhost though it renders content and all the links work, CSS isn’t rendered.

I haven’t made any drastic changes to theme and I don’t get why it works on my mac yet doesn’t on my Windows Pc.

I’ve had a similar issue in the past but those we’re usually solved by setting baseURL to " / ".
Right now I have that by default and thats what netlify and my mac seem to accept.

I have hard reset my browser cache’s also so that doesn´t fix either.

Any idea what else I could try`?

EDIT:

In my firefox browser I get this console error:

None of the "sha256" hashes in the integrity attribute match the content of the subresource

In my chrome i get this:

Failed to find a valid digest in the 'integrity' attribute for resource 'http://localhost:1313/css/style.min.f74778e3020c87c304fb5982e09b92ba63a5c7f202996d4c7283d6057acfe9c1.css' with computed SHA-256 integrity 'I2Cu7PcWr7mbQQ8Zslogp/ZfBTIize4oUMSZA8QA5bE='. The resource has been blocked.

Perhaps these are some culprits.

EDIT:
obsolete

I found this post

And looked into my head files.

I found this line :
<link rel="stylesheet" href="{{ $style.Permalink }}" {{ printf "integrity=%q" $style.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous">

And I comment the line:
{{ printf "integrity=%q" $style.Data.Integrity | safeHTMLAttr }}

This seems to have done it.

I don’t really like tampering with themes files as I dont understand much, so perhaps anyone smarter could explain if this is a sketchy workaround or that part of code is really obsolete.

I find it silly that It works on netlify and on mac local, but not on windows local.

-Thanks.

You are more likely to receive prompt and accurate assistance if you provide a link to the public repository for your project.

See https://discourse.gohugo.io/t/requesting-help/9132

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

So I have now copied the themes files into my main root directory.

This works both on mac, netlify and on windows.

Granted I wont get the latest updates from the submodule, but I don’t want to anyways.

Whilst it my work it sounds like you have reduced security by removing the subresource integrity (Subresource Integrity - Web security | MDN) hash, a visitors browser can no longer be certain that the file has not been tampered with.

The browser messages indicate that the hash value provided in the link tag does not match the hash of the file itself, i.e.: it is not the same file, so the browser does exactly what it is supposed to do when an integriry attribute has been presented and refuses to load the file.

My guess is that you have not run a build before deploying your files, but after making some changes in your sites, css. Tweak → Build → Deploy.

Also, you should not require the safeHTMLAttr filter as any valid hash value, would already be safe, you can just use integrity="{{ yourGeneratedHashValue }}.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.