Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failure to fetch CSS #213

Closed
Isweet opened this issue Dec 11, 2017 · 11 comments
Closed

failure to fetch CSS #213

Isweet opened this issue Dec 11, 2017 · 11 comments

Comments

@Isweet
Copy link

Isweet commented Dec 11, 2017

Hey,

I'm having an issue and I'm not sure what is causing it, but I thought I'd start here.

I am using Hyde + Github Pages to serve a personal site at: isweet.github.io.

When I open up the Chrome console, and visit the About page, I see the following error:

GET https://isweet.github.io/about/public/css/poole.css net::ERR_ABORTED

The reason this GET is failing is because the CSS isn't actually located there. It is located at:

https://isweet.github.io/public/css/poole.css

Now, if I look at _includes/head.html, I can see that the stylesheet is being imported as:

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

and that baseurl is set to:

baseurl:          /

inside of _config.yml.

So, it seems like for some reason site.baseurl isn't being interpreted as / but rather as /about when loading that page. I'm not sure why. Perhaps it has something to do with pretty permalinks?

It is possible this is my fault, as I'm relatively new to Jekyll + Hyde. Any help would be much appreciated.

@rewberl
Copy link

rewberl commented Dec 12, 2017

I'm having the same issue as of today. Thought it was something I had done on my end, but I only made a minor change in some body text

@Isweet
Copy link
Author

Isweet commented Dec 12, 2017

Seems like perhaps its a Jekyll issue, and that site.baseurl is resolving to the permalink rather than the value set in _config.yml. Maybe I should make an issue on the Jekyll repo?

@rewberl
Copy link

rewberl commented Dec 12, 2017

I fixed it by following the recommendation in #206 (github/pages-gem#460).

Change all of the instances of {{ site.baseurl }}sub/page/ to {{ "/sub/page/" | relative_url }} in your head page (in the _includes folder). relative_url is the actual text, not a reference to something you should insert. The /sub/page is the relative URL of your CSS file (or other file) on each line.

Then, change {{ site.baseurl }} to {{ "/" | relative_url }} in your sidebar page.

@Isweet
Copy link
Author

Isweet commented Dec 13, 2017

This worked for me, thanks so much!

Keeping this open so that (maybe) someone with a bit more experience can update the Hyde repository accordingly.

daniel-wells added a commit to daniel-wells/daniel-wells.github.com that referenced this issue Dec 30, 2017
@ketozhang
Copy link

ketozhang commented Jan 3, 2018

Should be a simple edit to commit no? Not too familiar with gem so any devs here can take a look at it?

😢 Last commit was 2015

@icehongssii
Copy link

thanks. It worked perfectly fine now.

@icehongssii
Copy link

icehongssii commented Feb 26, 2018

@ketozhang
To go your repository of Hyde theme. then go to "_includes" folder then modify the "head.html" as @rewberl said.
you will find this code.

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


All you have to do is find {{ site.baseurl }} and change to {{ "/" | relative_url }}

emcorrales added a commit to emcorrales/hyde-plus that referenced this issue May 12, 2018
Bug: CSS can't be fetched after installing the gem.
Expectation: CSS should be loaded properly from the header.html file.
Replication: Just install the gem on a jekyll site.
Cause: The base url is not properly configured.
Solution: Change {{ site.baseurl }} to "/". poole/hyde#213
@safijari
Copy link

safijari commented Oct 5, 2018

This works for me too. Is there any reason this isn't implemented in the main repo?

Edit: spoke too soon, I had to do <link rel="stylesheet" href="{{ '/' | relative_url }}public/css/poole.css">
(note the single quote)

multitudes pushed a commit to multitudes/oldmultitudes.github.io that referenced this issue Feb 1, 2019
abehmiel added a commit to abehmiel/abehmiel.github.io that referenced this issue Feb 16, 2020
@abulatek
Copy link

I know this is a super old post, but this fixed my issue of CSS only loading for the main page of my website (and not any of my non-main pages). Thank you so much!

@mdo
Copy link
Member

mdo commented Apr 4, 2020

Duplicate of #206 and fix coming in #258.

@mdo mdo closed this as completed Apr 4, 2020
aliaksandrkazlou added a commit to aliaksandrkazlou/aliaksandrkazlou.github.io that referenced this issue May 15, 2020
magsail added a commit to magsail/magsail_web_backup that referenced this issue Jun 16, 2020
Refer to this link for the issue
[Link](poole#213)
@elizasviel
Copy link

This worked for me -- thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants