Probably something stupid or simple here. But I have been tweaking my theme and it looks great when I run “hugo server --theme xyz” and test it. But when I open the index.html file from the generated /public folder it gives me barebones stock styling as if the css isn’t recognized. But viewing the source on index.html indicates the css file is being specified correctly. If it works on hugo server, shouldn’t it work when I test the generated /public folder version?
I’ve checked hugo config and the baseURL is being specified correctly.
What does the CSS path look like in the HTML headers in the public/ dir? A wild guess… it’s missing a slash somewhere in the path, which can probably be fixed by ending the baseURL with a slash.
Again, you can get more accurate help if you share the site source. Above is just from a guess.
I thought it might be a propogation issue (it’s hosted on AWS) but because this happens when I open the index.html file in the local public folder and it still has the problem is why I don’t think that’s it.
The stylesheet http://www.dogsbreakfast.xyz.s3-website-us-east-1.amazonaws.com/css/styles.css was not loaded because its MIME type, “text/plain”, is not “text/css”.
It’s not related to Hugo. You haven’t configured your server properly.
Thanks so much. Turns out S3 doesn’t apply the correct type to .css files consistently. Lots of people with similar issues in the past (though strangely it has worked for me up until now). Anyway, I had to change the mime-type of the css file through the AWS console. Unless I figure out how to get the content-type explicity set on css uploads from my end, I’ll have to remember to go check that next time I revise the css.
What do you use to upload to AWS? I use s3cmd and my “hack-ish” solution is to run a something like this after the website is uploaded to overwrite the text/plain CSS with the text/css mime-type.
s3cmd --acl-public --no-preserve --cf-invalidate --mime-type="text/css"
put public/css/hugo-octopress.css s3://parsiya.net/css/hugo-octopress.css