HarryPotterSpells / harrypotterspells.github.com

The official website for the project https://github.com/harrypotterspells/HarryPotterSpells hosted with github pages
https://harrypotterspells.github.io
0 stars 0 forks source link

Fix SEO issues #2

Open jacklin213 opened 1 year ago

jacklin213 commented 1 year ago

Currently with HashRouter being used, Google bot won't actually crawl these pages. Possible ways of improvements is:

jacklin213 commented 1 year ago

Notes on React snap:

Tried 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

jacklin213 commented 1 year ago

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.

jacklin213 commented 1 year ago

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.