NationalBankBelgium / stark

Modern client-side Web application framework based on Angular, Angular Material / Material Design, TypeScript, Redux, RxJS, ...
https://stark.nbb.be
Other
55 stars 23 forks source link

showcase: improve 404.html page on gh-pages branch to avoid using `location` to do the redirection on GitHub Pages #896

Open christophercr opened 5 years ago

christophercr commented 5 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/NationalBankBelgium/stark/blob/master/CONTRIBUTING.md#got-a-question-or-problem

Current behavior

Currently we have a 404.html page in the gh-pages branch in order to avoid the 404 default page from GitHubPages, This custom 404 page redirects to the root URL of the app (i.e. /showcase/latest, /showcase/10.0.0-beta.0, etc) following the solution described in http://www.backalleycoder.com/2016/05/13/sghpa-the-single-page-app-hack-for-github-pages/. However, the final solution has a "slight" difference: we do the redirection through the JavaScript location instead of the <meta http-equiv="refresh" content="0;URL='URL_HERE'"></meta>.

This difference has an inconvenient since it is not good for crawler indexing (SEO).

Expected behavior

We should be able to use the <meta http-equiv="refresh"> solution providing a dynamic URL that will be calculated in every version of the showcase (i.e. /showcase/latest, /showcase/10.0.0-beta.0, etc) so that it is optimized for crawler indexing (search engines).

What is the motivation / use case for changing the behavior?

To have a Showcase app optimized for SEO.

Environment


Angular version: 7.0.4
Stark version: 10.0.0-beta.2
carlo-nomes commented 5 years ago

I think I found an issue related to this. When you go to the subpath of a version that does not exist the app gets stuck in a loop. (eg: https://stark.nbb.be/showcase/asdf/)

christophercr commented 5 years ago

Thanks @cnomes, we'll track that one in #1058 😉