From 26365cb78052d3f760168ac4be791ad6e4520547 Mon Sep 17 00:00:00 2001 From: becarta Date: Tue, 11 Feb 2025 02:51:53 +0100 Subject: [PATCH] updated redirect --- astro.config.ts | 12 +++++--- public/_headers | 4 --- public/_redirects | 1 - public/robots.txt | 3 +- src/pages/index.astro | 70 ++++++++++++++++++++++++++++--------------- 5 files changed, 56 insertions(+), 34 deletions(-) delete mode 100644 public/_redirects diff --git a/astro.config.ts b/astro.config.ts index 3c17d14..64c77ce 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -1,7 +1,8 @@ import path from 'path'; import { fileURLToPath } from 'url'; + import { defineConfig } from 'astro/config'; -import netlify from "@astrojs/netlify/functions" + import sitemap from '@astrojs/sitemap'; import tailwind from '@astrojs/tailwind'; import mdx from '@astrojs/mdx'; @@ -9,7 +10,6 @@ import partytown from '@astrojs/partytown'; import icon from 'astro-icon'; import compress from 'astro-compress'; import type { AstroIntegration } from 'astro'; - import astrowind from './vendor/integration'; import { readingTimeRemarkPlugin, responsiveTablesRehypePlugin, lazyImagesRehypePlugin } from './src/utils/frontmatter'; @@ -21,8 +21,12 @@ const whenExternalScripts = (items: (() => AstroIntegration) | (() => AstroInteg hasExternalScripts ? (Array.isArray(items) ? items.map((item) => item()) : [items()]) : []; export default defineConfig({ - output: 'server', - adapter: netlify(), + output: 'static', + + i18n: { + locales: ["es", "en", "pt-br"], + defaultLocale: "en", + }, integrations: [ tailwind({ diff --git a/public/_headers b/public/_headers index 191cb2f..ed88e9a 100644 --- a/public/_headers +++ b/public/_headers @@ -1,6 +1,2 @@ /_astro/* Cache-Control: public, max-age=31536000, immutable - -/* - Access-Control-Allow-Origin: * - Accept-Language: * \ No newline at end of file diff --git a/public/_redirects b/public/_redirects deleted file mode 100644 index 492673f..0000000 --- a/public/_redirects +++ /dev/null @@ -1 +0,0 @@ -/* /api/:splat 200 \ No newline at end of file diff --git a/public/robots.txt b/public/robots.txt index 6f27bb6..ae3b0ba 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,2 +1,3 @@ User-agent: * -Disallow: \ No newline at end of file +Disallow: +Sitemap: https://www.365devnet.eu/sitemap-0.xml \ No newline at end of file diff --git a/src/pages/index.astro b/src/pages/index.astro index cc89ef6..f3ebdf8 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,29 +1,8 @@ ---- -const supportedLangs = ['en', 'nl', 'de']; -let chosenLang = 'en'; - -// Get the Accept-Language header from the request -const acceptLang = Astro.request.headers.get('accept-language'); - -if (acceptLang) { - const preferredLang = acceptLang.split(',')[0].trim().split('-')[0]; - if (supportedLangs.includes(preferredLang)) { - chosenLang = preferredLang; - } -} - -// Perform the redirect -Astro.redirect(`/${chosenLang}`); ---- - - - Redirecting... -