sudojunior / journey

A media database like IMDb, but run through GitHub and deployed on Jekyll.
https://gitjourney.vercel.app/
GNU General Public License v3.0
2 stars 0 forks source link

feat: Add auto redirect from language select? #37

Open sudojunior opened 3 years ago

sudojunior commented 3 years ago

If a page is visited in a specific language, local storage could be used to store the language key itself to be redirected as a failsafe if accessing the root of the site or if the page doesn't exist in the target language, but does in the saved / default language.

May also want to consider the plausibility of using a settings page that would be using local storage to store and retrieve values (would allow the end-user to select a language themselves instead of having to visit the page for said language).

/ -> /:lang/ # priority !!
/-/* -> /:lang/* # redirect generator
# invalid language identifiers may also be able to trip this failsafe on the 404 screen
# it should only redirect if a language key is already stored in cache

An 'API' export may also be needed soon, along with a robots.txt for page scrapping (not really bothered about bots as the pages themselves are mostly just HTML and CSS).

sudojunior commented 3 years ago

This is more so possible with navigator.language, but should be used with care to make sure the page exists before running that kind of logic. Use of localStorage as lastLanguage may also be an option, but heed caution when a decision is made to move deployment provider. (Vercel, Netlify, GH Pages, etc.)