Github Pages is Not Loading Specific Folders

Hi all,

I’m trying to use github-pages to host an online version of a spatial programming course, however the static files for stuff like CSS and JS aren’t loading properly.


what the website currently looks like

Whereas when I open the same file locally it appears like this:

preview of what the website should look like

When I inspect the network tab I can see that the CSS and JS files are 404’ing when requested, and I can’t access them either - e.g.

However, when I try accessing them directly from the repo everything is fine - e.g.

Github pages itself has been set up to read directly from the root repository of the master branch as well.

Any help solving this would be much appreciated

Hey @AyrtonB, welcome to the GitHub Support Community!

It looks like you’ve already managed to figure this out, but I’ll leave the answer just in case anyone else comes looking for solutions to a similar problem.

GitHub Pages uses Jekyll to build sites by default. Jekyll doesn’t include directories that start with certain special characters when building and deploying your site, including _:

If you’re using Jekyll to build your site and would like to include a file or directory that Jekyll excludes by default you can do this by specifying the path to the file/folder inside the include variable in your site’s _config.yml file:

If you’re not using Jekyll, and are building your site using pure HTML, CSS, and JS, or are using a different static site generator, you can disable Jekyll for GitHub Pages site builds altogether by creating a file called .nojekyll in the root of your publishing source:

Doing either of these should make your site available on GitHub Pages.

1 Like

Completely forgot about this until I just spotted the notifications whilst searching for something else just now, thank you for replying and posting the answer. Apologies for the poor etiquette.

1 Like