Skip to content

Bug: Loading GitHub default 404 #388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
terichadbourne opened this issue Feb 19, 2020 · 6 comments · Fixed by #397
Closed

Bug: Loading GitHub default 404 #388

terichadbourne opened this issue Feb 19, 2020 · 6 comments · Fixed by #397
Assignees
Labels
bug Something isn't working SEO

Comments

@terichadbourne
Copy link
Member

Just spotted this note from @zebateira on an older PR that's already been merged. When we changed the routing I believe we created fewer cases in which we can load our own 404, so we'll need to set up an alternative via GitHub for cases where, for example, the # is omitted from the URL.

Ah nice catch!

Interestingly hitting a GitHub-generated 404 and not our own - will this case be fixed by the routing PR you have in progress by any chance?

hm no, unfortunately, when you access any route besides / you will get github's 404.
but we can customize it using: https://help.github.com/en/github/working-with-github-pages/creating-a-custom-404-page-for-your-github-pages-site

@terichadbourne terichadbourne added the bug Something isn't working label Feb 19, 2020
@zebateira
Copy link
Contributor

Actually, if i'm not mistaken, only when you omit the # will you get Gitbhub's 404 page, and this was happening before the refactor since this is a problem with the current build system.

@zebateira
Copy link
Contributor

We can probably create a page that redirects to /#/404 when github catches a 404.

@terichadbourne
Copy link
Member Author

Are you envisioning using JavaScript within script tags in the HTML file to change window.location? Or some other method?

I started trying to play with this but I can't preview it properly.

On the real site, leaving out the # does this:
image

But on localhost it adds a #/ to the end and shows the homepage. ¯_(ツ)_/¯
image

Both the live site and localhost go to our custom 404 page if you try to access /#/nonsense.

@zebateira
Copy link
Contributor

zebateira commented Feb 21, 2020

@terichadbourne this is a problem with the current build system: we are only building one single index.html file that serves the root path /, so the 404 needs to be configured within github pages (server side) as per the documentation which actually relies on that 404.md file which I think should contain:

---
permalink: /#/404

But I might be wrong since the example in the docs uses the 404.html example.

@zebateira
Copy link
Contributor

zebateira commented Feb 21, 2020

After researching this issue a bit I stumbled upon a really cool hack that enables no-hash routing in github pages! It's working locally: #393
This also fixes this 404 issue as well.

@terichadbourne
Copy link
Member Author

Quick update: since #393 is more broad and affects a number of interrelated URL-ish issues (anchor tags, SEO, hash v history, hosting options, separate meta tags per page, redirects from GH 404), we've decided to instead (for now) create a 404.html to redirect the GitHub default as mentioned earlier in this trail and circle back later to ensure we're making the right decision for those interrelated issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working SEO
Projects
None yet
2 participants