Closed HarelM closed 2 months ago
I've made a test to see if the above repo solution works and it looks like it does. I've manually changed the gh-pages branch by adding the 404.html file with 1 as the segment path and added the relevant part to the index.html file. Not sure how this will affect the local dev environment though.
This 404 setup + lot's of redirecting first to, and then away from, /?/
is really a last resort imo as it'll i.e. never be able to work with SEO, caching etc.
What is technically blocking fixing it at the origin cause and pre-rendering these pages?
I've never used angular with SSR so my knowledge here is limited. From what I can tell the following is what you are referring to, right? https://angular.io/guide/prerendering Adifferent solution is the following SSR requires server side configuration, which won't work with github pages as far as I can tell: https://angular.io/guide/ssr#why-use-ssr
Yea, the 404 setup won't work well with SEO as far as I can tell.
Yes, the first link is what I'm referring to - or in the new docs (think content is the same) , but angular.io will be sunset soon: https://angular.dev/guide/prerendering#how-to-prerender-a-page
I'll look into it, thanks for the idea!
I've spent like an hour on this, getting no where. See here: https://github.com/angular/angular/issues/54965 It's extremely undocumented in google and it seems like version 17 incorporated an external package so all the examples are out dated, I think. Not sure it's worth the extra effort. I tend to make the current workaround an official solution until someone decides that it might interest them enough to do it and open a PR here. I can leave this issue open in case someone stumbles on this in the future.
This seems to work can you check again
I have added a 404.html file, but it's not a great solution. Having said that, I was not able to prerender the angular showcase app.
At least the 404 works! :)
Seems like the above PR with the SSR prerendering solve this issue well. Thanks @birkskyum and @marcjulian!!
This is described here basically: https://github.com/isaacs/github/issues/408
Steps to reporduce:
This is because a SPA page assumes the server will return the index.html file for every unknown route, which doesn't happen in github as is explained in the issue above.
The proposed solution there is to create redirects in cloudflare or use the instructions described here: https://github.com/rafgraph/spa-github-pages
@birkskyum let me know if you would like to try out the CDN redirect.