Open jacklin213 opened 1 year ago
Notes on React snap:
BrowserRouter
either wayTried plugging it into the project (Added 17 red npm audit issues), was able to successfully run react-snap
when site was using HashRouter
(But only finds home page). Once migrated to BrowserRouter
, it successfully detected 7 pages but only was able to pre-render downloads
, commands
, and spells
.
No longer considering React snap a viable option. If SEO still is unable to index the sub-pages, will look into other pre-rendering solutions
Upon testing live URL in Google Search console, because the BrowserRouter
hack relies on hitting a 404 first before serving 404.html
which has the custom redirect logic, this method won't work as google won't index pages that return 404.
Didn't read through the README of spa-github-pages
properly. The seo section clearly covers the above point and how you have to index the redirect route eg) https://harrypotterspells.github.io/?/spells
as opposed to https://harrypotterspells.github.io/spells
.
Though this still doesn't solve the problem that 404 is returned by Github Pages first before the correct route is returned.
Currently with
HashRouter
being used, Google bot won't actually crawl these pages. Possible ways of improvements is:Such as React snapUsingBrowserRouter
instead ofHashRouter
.BrowserRouter
out of the box as https://harrypotterspells.github.io/downloads will go the gh-pages server, the server will see there is nodownloads
project and return a 404index.html
with a custom redirect parameter as shown here