I am trying to use the PaperMod theme with Hugo on a fresh website. When I run it locally, everything is great. When I upload it to GitHub, the theme does not work.
baseURL = "https://matthewcrews.com"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "hugo-PaperMod"
Website Dev Repo: https://github.com/matthewcrews/blog
Site Repo: https://github.com/matthewcrews/matthewcrews.github.io
Hugo: Hugo Static Site Generator v0.78.2-959724F0 windows/amd64 BuildDate: 2020-11-13T10:08:15Z
What I Expect:
Start troubleshooting by looking at the browser’s console…
Looks nothing like the config.toml contents that you posted above.
The repo is up to date now. You will see that it matches what I posted. The problem persists. Everything appears to be working but the theme does not load:
You’ve updated your site source (last commit 30min ago) but not the generated site (last commit 4h ago).
You need to regenerate the site, then push the regenerated site as well.
The site was up to date at the time that I asked the question. I had not pushed the change to the site source to GitHub yet. I rebuilt and there are no changes. I am seeing the following error but I have no idea what it means.
Failed to find a valid digest in the 'integrity' attribute for resource 'https://matthewcrews.com/assets/css/stylesheet.min.8cbe03cd36d575ee2d4398db2c2b89694db1f7cf71d909908b0cf8aeca1ad007.css' with computed SHA-256 integrity 'NKDquP9+VB7hHwt5XWjGzS7hEaS/jjp7y5hsSpIBuNI='. The resource has been blocked.
The problem was with line endings and the hash that is generated. The SHA-256 hash is different for the files if the file has LF or CRLF line endings. I had to disable the integrity check to get the theme to work. This feels like an inadequate workaround.
Nice work. Please confirm my understanding:
- On your local machine, when editing and saving files, each line is terminated by CRLF.
- When you commit your changes, git converts the line endings to LF.
- When you serve your pages from GitHub, the integrity string created when you built your site on your local machine doesn’t match the file in the repository.
Is that correct?