I've been hosting a personal page through Github Pages using Jekyll for a couple years now. It's worked perfectly until this evening. I pushed a new blog post out and suddenly the blog portion of the site is unable to render any of my CSS (it still works in portions of the site not generated by Jekyll). I've checked everything in my commits – nothing seems to have changed – and even rolled back everything to an older commit (from a few months ago) without any improvement. Have there been any changes to GH Pages that could have caused this? Any clues?
1
votes
What is the exact problem of the CSS file? Main stylesheet is loading fine.
– marcanuy
I can't identify any sort of problem with the file itself.
– gweintraub
There are 404 errors in the console for the missing assets and CSS, so it seems like a broken reference, I just can't figure out where that broken reference would be or how it could have broken without changing anything.
– gweintraub
I just see wrong urls for background images in lightbox.css, rest of the site seems to be ok.
– marcanuy
1 Answers
2
votes
In includes/head.html
you are including the CSS file with:
<link rel="stylesheet" href="{{ "css/main.css" | prepend: site.baseurl }}">
but it isn't taking into account the site.url
variable, to generate a complete url with site.url
and site.baseurl
use the absolute_url
filter:
<link rel="stylesheet" href="{{ 'css/main.css' | absolute_url }}">
Now your links would be generated fine when you visit deeper levels of the website.