Github pages not linking to CSS

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!

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/.

4 Likes

I’ll give it a go, thanks.

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

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:

3 Likes

super helpful. thank you!