Fixing Hugo Display Issues Caused by Missing CSS
Press F12 to open the console, and you will see the error Failed to find a valid digest in the 'integrity' attribute for resource, which manifests as the page showing only text and icons with the layout gone. Local deployment or access via IP works fine, but access via the domain name fails.
Solution
The idea comes from Hugo - Failed to find a valid digest in the ‘integrity’ attribute for resource - The resource has been blocked - Host on Github.
The cause of this problem is a Cloudflare setting — Auto Minify, which strips the spaces and some formatting from html, js, css and other files to shrink their size and optimize access speed. However, after the files are modified, the file verification fails when the site is accessed, so the browser blocks the file from loading for security reasons, which leads to the problem.
The solution is to turn off this setting; the gain is negligible anyway 🤣.
