Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I've setup my site at GitHub using Jekyll framework. I've a problem with 404's. I added a 404.html and it is working well for some typos. But, since in Jekyll categories are rendered in a separate directories and when a user is trying to access the URL like www.example.com/category/ it shows the GitHub's 404 instead of my custom 404.html and also I don't want to index the category so what can I do?

P.S: Added a index.html to each and every category is a good idea. But, while building it overwrites everything in Jekyll.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

According to the GitHub documentation on custom 404s you are out of luck:

Custom 404s only work when they are served from the root of a Pages domain, for example a project using a custom domain or a user pages repository.

It looks like sub-folders are not supported. Only the root folder.

share|improve this answer
    
That's not correct. They are, as long as you use a custom domain or you are creating a user pages. I agree, the explanation is a little bit confusing. –  Simone Carletti Jan 12 at 13:05

GitHub allows you to create a custom 404 page but there is a caveat. The 404 will be displayed only if you use a custom domain or for user pages.

Custom 404s only work when they are served from the root of a Pages domain, for example a project using a custom domain or a user pages repository. A custom 404 page on project pages that are not using a custom domain will not work

In other words, the 404 error page will not work for project pages with no custom domain.

In your case, it looks like you are using a custom domain thus the limitation may not apply to you. Are you sure your 404 is working correctly and you don't have an issue elsewhere?

Just to show you an example, in our company blog we use Jekyll, we host the page on GitHub pages and we have a custom 404 error page. As you can see, it also works on a subfolder.

Try to visit this page

http://blog.dnsimple.com/2011/invalid

and you can check yourself. If it helps you to debug, the pages are generated directly by GitHub. We have another repository where we publish the HTML pages to GitHub (instead of a Jekyll powered website), I should check if in that case it also works.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.