Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I fix 404 error importing css on GitHub Pages?

I currently have the following Git Repository: https://github.com/SebastianGode/ansible-collection-cloud/tree/gh-pages And the GitHub Page link: https://sebastiangode.github.io/ansible-collection-cloud/

The problem is that GitHub Pages will only solve the index.html and will throw an 404 for all required css and image stuff: enter image description here

As the documentation is getting automatically generated by a travis-ci pipeline it's probably impossible to change paths, but as it works when hosted it locally it also should work on GitHub pages.

Is there any solution to this problem?

like image 885
Felixkruemel Avatar asked Sep 03 '25 03:09

Felixkruemel


1 Answers

I fixed it.

GitHub has Jekyll running behind it which will mess up special paths (here the underscore paths). You can disable jekyll by just creating a .nojekyll file in the root directory of the branch. If you use travis-CI for something like that and run a tox script just call the command touch {toxinidir}/.nojekyll

This will result in a working website for me.

like image 101
Felixkruemel Avatar answered Sep 06 '25 20:09

Felixkruemel