From 30aae62f3e2f9943a39bbd087ba7798b99413d8b Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Sat, 22 Feb 2025 18:24:43 +0000 Subject: [PATCH 1/4] feat: create index.astro for redirect because we want to use ogp for /2025 path --- 2025/astro.config.mjs | 3 +-- 2025/src/components/LanguagePicker.astro | 10 ++++++++-- 2025/src/pages/index.astro | 6 ++++++ 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 2025/src/pages/index.astro diff --git a/2025/astro.config.mjs b/2025/astro.config.mjs index fca14518..7c52539a 100644 --- a/2025/astro.config.mjs +++ b/2025/astro.config.mjs @@ -13,8 +13,7 @@ export default defineConfig({ }, redirects: { - '/': '/2025/ja', - '/2025': '/2025/ja', + '/': '/2025', }, vite: { diff --git a/2025/src/components/LanguagePicker.astro b/2025/src/components/LanguagePicker.astro index d3432d96..69c6b023 100644 --- a/2025/src/components/LanguagePicker.astro +++ b/2025/src/components/LanguagePicker.astro @@ -2,7 +2,13 @@ // @ts-expect-error not found import { base } from 'astro:config/client'; -const languages = Object.keys(import.meta.glob('../pages/*.astro')).map(p => p.split('/').at(-1)!.replace('.astro', '')).sort(); +const languages + = Object.keys(import.meta.glob('../pages/*.astro')) + .map(p => p.split('/') + .at(-1)! + .replace('.astro', '')) + .filter(lang => lang !== 'index') + .sort(); const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, ''); const currentLang = pathname.split('/')[1]; --- @@ -13,7 +19,7 @@ const currentLang = pathname.split('/')[1]; {lang.toUpperCase()} {i < languages.length - 1 && /} - + ))} diff --git a/2025/src/pages/index.astro b/2025/src/pages/index.astro new file mode 100644 index 00000000..9b89f056 --- /dev/null +++ b/2025/src/pages/index.astro @@ -0,0 +1,6 @@ +--- +import Layout from '@/layouts/Layout.astro'; +--- + + + From d69fbb86e873db076069d674ae504775b41f3e97 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Sat, 22 Feb 2025 18:29:01 +0000 Subject: [PATCH 2/4] feat: load favicon with static url --- 2025/{public => src/assets}/favicon.ico | Bin 2025/src/layouts/Layout.astro | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) rename 2025/{public => src/assets}/favicon.ico (100%) diff --git a/2025/public/favicon.ico b/2025/src/assets/favicon.ico similarity index 100% rename from 2025/public/favicon.ico rename to 2025/src/assets/favicon.ico diff --git a/2025/src/layouts/Layout.astro b/2025/src/layouts/Layout.astro index 418dca95..b18fe9d6 100644 --- a/2025/src/layouts/Layout.astro +++ b/2025/src/layouts/Layout.astro @@ -1,4 +1,5 @@ --- +import favicon from '@/assets/favicon.ico?url'; import Footer from '@/components/Footer.astro'; import Header from '@/components/Header.astro'; import { BASE_URL } from '@/consts'; @@ -37,7 +38,7 @@ const ogImageUrl = ufo.joinURL(BASE_URL, 'og.png'); image: ogImageUrl, }} extend={{ - link: [{ rel: 'icon', href: '/favicon.ico' }], + link: [{ rel: 'icon', href: favicon }], }} /> From 8682d3f1a9e8f5be8c42c15a02996f1412fae40d Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Sat, 1 Mar 2025 20:35:07 +0000 Subject: [PATCH 3/4] feat: remove redirect from astro config --- 2025/astro.config.mjs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/2025/astro.config.mjs b/2025/astro.config.mjs index 7c52539a..9fb6f6f3 100644 --- a/2025/astro.config.mjs +++ b/2025/astro.config.mjs @@ -12,10 +12,6 @@ export default defineConfig({ serializeConfig: true, }, - redirects: { - '/': '/2025', - }, - vite: { optimizeDeps: { exclude: [ From ae6db0f086848de06a4f33d8b342244f8d47f484 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Sat, 1 Mar 2025 20:37:10 +0000 Subject: [PATCH 4/4] feat: use slot header --- 2025/src/layouts/Layout.astro | 3 ++- 2025/src/pages/index.astro | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/2025/src/layouts/Layout.astro b/2025/src/layouts/Layout.astro index b18fe9d6..49e039f7 100644 --- a/2025/src/layouts/Layout.astro +++ b/2025/src/layouts/Layout.astro @@ -17,7 +17,8 @@ const ogImageUrl = ufo.joinURL(BASE_URL, 'og.png'); - + + - - + + + + +