Viewing site through terminval vs through local files

Hi,

I’m just wondering why is there a discrepancy in viewing through terminal (i.e. no CSS/JS is shown) while viewing it through local files works as expected.

You can check the illutrastion below

If you look at the Developer tools/console in the browser, it will indicate which URLs are failing. Probably the path to assets is the issue.

1 Like

usually the problem would be the opposite - as the webserver allows a lot more than just the file browser does.

My guess is your link to the css is like assets/main.css when it probably should be /assets/main.css (should have a leading slash to have it be a relative url).

Like Chuck says a quick look at the dev tools console (right click on the page somewhere and choose Inspect then look for the Console tab) will show you the path it is trying to load.

If you post a link to your repo someone can check it out. Without seeing what you have it is pretty hard to diagnose, I have only used the file system to browse a site a couple times just to see what it did, not many people will have first had experience on all the ins and outs.

1 Like

@chuckhoupt @rdyar

Apologies for the late response. It seems like the forum notification went to the span folder.

Anyhow, as you suggested I checked the console tab.
It did have some error on some files but the file actuall exist. You can see proof here:

Here is the link of the repo: GitHub - bentraje/jekyll-test-site
Here is the link of the site: Your awesome title

just because the file exists does not mean that it is being served to the public.

On your public site where the stuff isn’t loading and you have console errors it says you are trying to load this file:

https://bentraje.github.io/assets/js/jquery-2.1.1.min.js

but you can’t load it as it is returning a 404 for some reason.

I am not sure if this is your question or not though, seems different than your original question and I don’t see how you could see this file locally without even a server - maybe it is cached locally?

RE: how you could see this file locally without even a server - maybe it is cached locally?
TBH I’m not sure (totally new to this :frowning: ). But I’m guessing maybe it is cached locally.
That said I have the same problem as before: the site is not using the theme.

Which I do not understand since I don’t modify the files at all. I just literally revised the theme: line in the .yml file. No adding, copying or removing of any static files. That’s why I kinda expect it out of the box.

=====

I guess it has something to do with the theme?
Because when I use the default ones, it works as expected lol

But I really wanted the RTD theme so bad. I read more notes with that theme.

in my post above where I say the link is a 404 it is because you are not prefixing it with your baseurl. If you do that it works:

https://bentraje.github.io/jekyll-test-site/assets/js/jquery-2.1.1.min.js

there was another file you were loading that was broken also, it probably needs the same thing.

Do some research on baseurl in the config file if you are not sure what it is.

1 Like

The baseurl trick did the work.

Just added this on my yml file.
baseurl: "jekyll-test-site"

Works as expected. Thanks! :slight_smile: