Links on my repos doesnt seem to be woking anymore

here is my repo: Blog
css, javascripts, link to other pages does not work anymore. It works locally but not on github anymore, it used to work before. I checked the git logs there was no major change I did that would affect it(that I know of).

When I opened the site: https://juscuizon.github.io/blog/
Check main.css: https://juscuizon.github.io/assets/css/main.css

Is getting 404 error.

Same for:

https://juscuizon.github.io/assets/js/image-preload.js
https://juscuizon.github.io/assets/js/navigation-button.js
https://juscuizon.github.io/assets/js/image-preload.js
https://juscuizon.github.io/assets/img/avatar.jpg
https://juscuizon.github.io/assets/img/small-avatar.jpg
https://juscuizon.github.io/assets/img/favicon.ico

It’s a path problem.

Correct one:
https://juscuizon.github.io/blog/assets/css/main.css

On [username].github.io, the site is located at a sub-directory. Hence the resource paths being similar to https://juscuizon.github.io/blog/assets/css/main.css. You can either set baseurl config to /blog and try again or change the liquid variable in layouts to use the relative_url and absolute_url filters:

<link rel="stylesheet" href="{{ 'assets/css/main.css' | relative_url }}">

@SidV my path locally is {{site.baseurl}}/assets/js/image-preload,js

I don’t know why {{site.baseurl}} does not work anymore, it used to work last week.

In my config.yml baseurl is set to baseurl=’’

@ashmaroli I tried setting baseurl to /blog before and still wont link correctly.

Just now I tried using a custom domain, it works fine. But I don’t get why it does not work in gh-pages. All of my other repos have the same config.yml they work fine on gh-pages links and everything. I just can’t understand why this certain repo wont work on gh-pages.

That’s the problem.
I think you must use:

baseurl: "/blog/" #important: start with /
url: "https://juscuizon.github.io/blog/"

@SidV yea the problem is the baseurl:'' It used to work a week ago. the problem with putting baseurl:/blog/ is that it wont work locally. I used to be able to work locally and push to github and both would work fine. Well I will try to revert back to jekyll 3.4 because all of my repos below 3.5 still work with baseurl=’’ for github.

Hi Juscuizon… You can work locally with baseurl if you apply --baseurl in your CMD line…

eg: bundle exec Jekyll serve --baseurl

Hope that can help.

@sparky i have no problem with my local baseurl, it is just with github, baseurl:'' does not work anymore on github it used to work about a week ago.

What exactly are you trying to achieve with baseurl: ''?

The correct way to use it has been best summarized here by one of the Jekyll maintainers: https://byparker.com/blog/2014/clearing-up-confusion-around-baseurl/

1 Like