This one had me in a bind for a little while. I’ve been hosting my pelican generated static site on GitHub and for the first time had attempted to link to some files hosted locally in a subdirectory of the repository. While the links to the files would work as expected when served up from the python http server on my laptop, once uploaded online to github, they would just result in dead links.
Being a novice to hosting via GitHub Pagess I first assumed that this had something to do with GitHub not supporting files in subdirectories when using a custom domain with CNAME redirect. Of course, that was nonsense, and I should have known it given that I had template files in other directories such as /css which the browser could load just fine.
Finally, after some fooling around, I asked the right question:
“Does GitHub Pages support directories beginning with a preceding .(dot)?”
The answer is yes, they do, but not by default. To get
things working what you need to do is create a file called
.nojekyll in the base site directory.
Now I’m wondering about a few other things:
Is it bad practice to have online directories beginning with a .dot?
Can a directory in a repository on GitHub Pages be made browseable in a conventional, ‘apache web server’ kind of way? That is, without receiving an error when typing http://yourwebsite.com/yourdirectory and without the rest of the GitHub Interface getting in the way.
Should I be using GitHub Pages to host my non code related site at all? The use of their content delivery network (CDN) is alluring, as is the price (free!), but it seems like using an online hosted version control interface for regular mundane static site hosting is a misuse of an advanced tool.
Those are questions for another day…probably answerable by someone else if I ever get around to setting up commenting on this site.