summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Fred K. Schott <fkschott@gmail.com> 2021-08-04 14:22:11 -0700
committerGravatar GitHub <noreply@github.com> 2021-08-04 14:22:11 -0700
commiteafbb45f0473a7207d37006de0537cfd123a4421 (patch)
tree918247089c9bd237ebde2ebe0a703cc823e59234
parent6a4a9fe3a12cb8cd0a63358a4b2df9148200380d (diff)
downloadastro-eafbb45f0473a7207d37006de0537cfd123a4421.tar.gz
astro-eafbb45f0473a7207d37006de0537cfd123a4421.tar.zst
astro-eafbb45f0473a7207d37006de0537cfd123a4421.zip
update automatic docs redirect (#1014)
-rw-r--r--docs/src/pages/es/getting-started.md2
-rw-r--r--docs/src/pages/index.astro9
2 files changed, 7 insertions, 4 deletions
diff --git a/docs/src/pages/es/getting-started.md b/docs/src/pages/es/getting-started.md
index 0feb2d008..2766c0a87 100644
--- a/docs/src/pages/es/getting-started.md
+++ b/docs/src/pages/es/getting-started.md
@@ -1,7 +1,7 @@
---
layout: ~/layouts/MainLayout.astro
title: Empezando
-lang: 'es'
+lang: es
---
Astro es un creador de sitios estáticos moderno. Aprende de qué de trata Astro en nuestra [página principal](https://astro.build/) o nuestra [publicación](https://astro.build/blog/introducing-astro) de lanzamiento. Esta página es una descripción general de la documentación de Astro y todos los recursos relacionados.
diff --git a/docs/src/pages/index.astro b/docs/src/pages/index.astro
index e156ca7eb..2b090ca81 100644
--- a/docs/src/pages/index.astro
+++ b/docs/src/pages/index.astro
@@ -6,13 +6,16 @@ import Layout from '../layouts/MainLayout.astro';
// This is some wip redirect code based on the browser language.
// A vercel.json redirect is enforced in production, so no user should ever see this page.
// Remove the vercel.json redirect when this is ready.
- const KNOWN_LANGUAGES = ['en', 'nl', 'fi','zh-CN','zh-TW'];
- let newLang = (window.navigator.userLanguage || window.navigator.language || 'en').substr(0, 2);
+ const KNOWN_LANGUAGES = ['de','en','es','fi','nl','pt-br','zh-CN','zh-TW'];
+ let newLangWithRegion = (window.navigator.userLanguage || window.navigator.language || 'en-US').substr(0, 5);
+ let newLang = newLangWithRegion.substr(0, 2);
if (newLang === 'en') {
window.location.pathname = '/getting-started';
+ } else if (KNOWN_LANGUAGES.includes(newLangWithRegion)) {
+ window.location.pathname = '/' + newLangWithRegion + '/getting-started';
} else if (KNOWN_LANGUAGES.includes(newLang)) {
window.location.pathname = '/' + newLang + '/getting-started';
} else {
- window.location.pathname = '/getting-started';
+ window.location.pathname = '/getting-started';
}
</script> \ No newline at end of file