Github pages not linking to CSS

Github pages not linking to CSS
0

#1

I’m attempting to link this site up to the css: https://if-apps.github.io/simple-website-template/

I’ve done this: <link rel="stylesheet" type="text/css" href="/css/style.css">. I know that should work, but it just isn’t. It’s in the CSS folder, linking to the sheet. The same goes for bootstrap.

Here is the repo: https://github.com/IF-Apps/simple-website-template

Thanks in advance!


#2

Have you tried removing the first / (css/style.css)?

EDIT:
I found that using / makes the URL “root-relative”, which is https://if-apps.github.io instead of the expected https://if-apps.github.io/simple-website-template/.


#3

I’ll give it a go, thanks.


#4

Wow, it works, thank you! I thought they required a / - I’ve found on other sites they certainly have.


#5

Relative paths only work with server rendering, if you host on github pages that would be static hosting and thus would need to provide an absolute path starting with http: