Ah this was one of the most annoying things, I encountered this week !

Hosting Static Sites on Github Pages should be easy and it is, I’ve used it before too and its one of the best hosting medium !

BUT…

Using HUGO to generate a static site and host it on Github Pages was pretty annoying.

It was very easy on the development side of things, deployment was the opposite but got it sorted it. Using hugo --ignoreCache -t PaperMod built a public/ directory where the static site was generated and pushing it the remote repo and hosting would have done the job but for some reason the CSS and JS was not loading what so ever. It was HTML ONLY !

Checked the baseURL in the hugo.toml file and everything was correct, rebuilt it multiple times with different settings like from scratch, not using build cache and other stuff none worked. Thanks to Copilot which suggested me to see networks tab in the dev tools and there I found that due an integrity mismatch the files were blocked !

Getting this error:

Failed to find a valid digest in the 'integrity' attribute for resource...
The resource has been blocked.

Thanks to this thread, I was able to fix it !

I navigated to themes/layouts/partials/head.html and edited the file ! (NOTE: The location or the file itself might be different for different themes)

integrity="{{ $stylesheet.Data.Integrity }}"

to

integrity=""

Now no integrity to verify, no blocking of resources !

Although the integrity was for security purposes and should be used if CDN are used or similar stuff. But for static site hosting like this one its very safe.