简体   繁体   中英

Github pages not loading css on subfolders

Any idea why github pages stoped loading css and images in subfolders, it works fine on the root of the site.

When i checked the source code of the page, i see this

"href="css/bootstrap-3.3.6/css/bootstrap.min.css">" 

instead of

"href="/css/bootstrap-3.3.6/css/bootstrap.min.css">".

In my config file I have a line

baseurl : /

--> crowd42.github.io

Thanks

It should work the way it is baseurl : "/" if when loading assets you use that variable:

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

As it seems that you aren't using base urls, you can try forcing the root path with a slash at the beginning:

<link rel="stylesheet" href="/css/main.css">

Or including the absolute path:

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

with baseurl: "" .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM