Skip to content

Commit 30aae62

Browse files
committed
feat: create index.astro for redirect because we want to use ogp for /2025 path
1 parent 3e131b7 commit 30aae62

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

2025/astro.config.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ export default defineConfig({
1313
},
1414

1515
redirects: {
16-
'/': '/2025/ja',
17-
'/2025': '/2025/ja',
16+
'/': '/2025',
1817
},
1918

2019
vite: {

2025/src/components/LanguagePicker.astro

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
// @ts-expect-error not found
33
import { base } from 'astro:config/client';
44
5-
const languages = Object.keys(import.meta.glob('../pages/*.astro')).map(p => p.split('/').at(-1)!.replace('.astro', '')).sort();
5+
const languages
6+
= Object.keys(import.meta.glob('../pages/*.astro'))
7+
.map(p => p.split('/')
8+
.at(-1)!
9+
.replace('.astro', ''))
10+
.filter(lang => lang !== 'index')
11+
.sort();
612
const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, '');
713
const currentLang = pathname.split('/')[1];
814
---
@@ -13,7 +19,7 @@ const currentLang = pathname.split('/')[1];
1319
{lang.toUpperCase()}
1420
</a>
1521
{i < languages.length - 1 && <span class="separator">/</span>}
16-
</>
22+
</>
1723
))}
1824
</div>
1925

2025/src/pages/index.astro

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
import Layout from '@/layouts/Layout.astro';
3+
---
4+
<Layout />
5+
6+
<meta http-equiv="refresh" content="0;url=/2025/ja" />

0 commit comments

Comments
 (0)