Jekyll site works locally but not on Github Pages

匆匆过客 提交于 2019-12-17 20:45:19

问题


I forked the Solid-jekyll theme (solid-jekyll) and got it to work locally. However, when I pushed it up to Github pages, it seems to loose it's css formatting.

My fork of solid-jekyll is on github, username:BeenzSyed. I tried changing the baseurl to "/solid-jekyll" but that didn't work either.

This is what it looks like on my fork: https://beenzsyed.github.io/solid-jekyll/.

This is what it should like though: http://ojs.xyz/solid-jekyll/.

I think it's because it can't find the _includes/css/style.css file but I'm not sure what to do to fix that. Any help is appreciated!


回答1:


Faced exactly same issue long back and it consumed 2-3 days. Find your main stylesheets (like main.css) and save it to assets folder and commit. This way Github will be copying stylesheet to site built. It usually won't copy :( main.css




回答2:


I followed the suggestion of dracos on this GitHub Issue page and related commit to change /_includes/head.html from:

<link rel="stylesheet" href="{{ site.baseurl }}public/css/poole.css">

to

<link rel="stylesheet" href="{{ "/public/css/poole.css" | relative_url }}">

Changing most site.baseurl references to relative_url works in both local testing and on GitHub Pages.

My commit for changes to my site can be found below: https://github.com/naamancampbell/naamancampbell.github.io/commit/f60da4d4e48447708c2e157ff1e07303d5377587




回答3:


As someone pointed out, the live demo uses a different stylesheet. So the repo isn't the same. I suggest creating a new issue in the repository.



来源:https://stackoverflow.com/questions/42450554/jekyll-site-works-locally-but-not-on-github-pages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!