mirror of
https://github.com/withastro/astro.git
synced 2025-01-20 22:12:38 -05:00
update automatic docs redirect (#1014)
This commit is contained in:
parent
6a4a9fe3a1
commit
eafbb45f04
2 changed files with 7 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
layout: ~/layouts/MainLayout.astro
|
layout: ~/layouts/MainLayout.astro
|
||||||
title: Empezando
|
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.
|
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.
|
||||||
|
|
|
@ -6,10 +6,13 @@ import Layout from '../layouts/MainLayout.astro';
|
||||||
// This is some wip redirect code based on the browser language.
|
// 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.
|
// 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.
|
// Remove the vercel.json redirect when this is ready.
|
||||||
const KNOWN_LANGUAGES = ['en', 'nl', 'fi','zh-CN','zh-TW'];
|
const KNOWN_LANGUAGES = ['de','en','es','fi','nl','pt-br','zh-CN','zh-TW'];
|
||||||
let newLang = (window.navigator.userLanguage || window.navigator.language || 'en').substr(0, 2);
|
let newLangWithRegion = (window.navigator.userLanguage || window.navigator.language || 'en-US').substr(0, 5);
|
||||||
|
let newLang = newLangWithRegion.substr(0, 2);
|
||||||
if (newLang === 'en') {
|
if (newLang === 'en') {
|
||||||
window.location.pathname = '/getting-started';
|
window.location.pathname = '/getting-started';
|
||||||
|
} else if (KNOWN_LANGUAGES.includes(newLangWithRegion)) {
|
||||||
|
window.location.pathname = '/' + newLangWithRegion + '/getting-started';
|
||||||
} else if (KNOWN_LANGUAGES.includes(newLang)) {
|
} else if (KNOWN_LANGUAGES.includes(newLang)) {
|
||||||
window.location.pathname = '/' + newLang + '/getting-started';
|
window.location.pathname = '/' + newLang + '/getting-started';
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue