cssgithub-pagessidebarjupyterbook

Getting sidebar to work on github pages with jupyter book


I've built a github repository for a jupyter book. Currently I'm focusing on getting all the structure in place before I start writing.

When I view the html pages from my local repository (in the docs folder), they have the appearance I want. There is a useful sidebar, looking like:

The html file from my local repository

When I view them on github pages the sidebar is dysfunctional. It is missing some images and appears above rather than beside the main text. It looks like:

the page as it appears on github pages

I don't know how to fix the github pages view. As far as I can tell, every relevant file is on github (my .gitignore only ignores .log and _build).


Solution

  • The issue is that

    1. The html has links to .css files in the folder _static to be in the same directory.
    2. However, by default, github pages ignores folders starting with an underscore.

    So none of the .css files were moved to the server. So the style information wasn't there.

    The solution is to put an empty file named .nojekyll into the docs folder (or whichever folder the github pages are coming from). This leads github pages to include the underscore folders.