Bugfix/ redirects
This PR changes the netlify configuration to better redirect users with a supported language.
Instead of automatically redirecting users to the default english language version of the site, it first directs them to a symlinked copy denoted with an underscore (_
).
If a user is viewing a page on the automatically default locale (/_/
), but a translation is available ( i.e. accept-language: de
), they'll then be redirected further to a translation in their language. (/_/team => /de/team
).
If user selects a language manually, they'll be routed to the locale manually as before (i.e .accept-language: en
but navigates to /es/
). Importantly, after manual selection, they will not be redirected off their selected locale, because they are not on the default shadow locale (/_/
).
A similar configuration has been tested on a PR for the bch.info repo here: https://github.com/bchinfo/bch.info/pull/205
The configruation can be tested locally with netifly-cli: netlify dev -c 'yarn start' --target-port 3000