Skip to content

Commit 79daf1c

Browse files
authored
Merge pull request #180 from vim-jp/feature/use-index-for-redirect
2 parents 3e131b7 + ae6db0f commit 79daf1c

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

2025/astro.config.mjs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ export default defineConfig({
1212
serializeConfig: true,
1313
},
1414

15-
redirects: {
16-
'/': '/2025/ja',
17-
'/2025': '/2025/ja',
18-
},
19-
2015
vite: {
2116
optimizeDeps: {
2217
exclude: [
File renamed without changes.

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/layouts/Layout.astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
import favicon from '@/assets/favicon.ico?url';
23
import Footer from '@/components/Footer.astro';
34
import Header from '@/components/Header.astro';
45
import { BASE_URL } from '@/consts';
@@ -16,7 +17,8 @@ const ogImageUrl = ufo.joinURL(BASE_URL, 'og.png');
1617
<!DOCTYPE html>
1718
<html lang={lang}>
1819
<head>
19-
<meta charset="utf-8" />
20+
<slot name="header" />
21+
<meta charset="utf-8" />
2022
<GoogleFontsOptimizer url="https://fonts.googleapis.com/css2?family=Cardo:ital,wght@0,400;0,700;1,400&display=swap" />
2123
<SEO
2224
{title}
@@ -37,7 +39,7 @@ const ogImageUrl = ufo.joinURL(BASE_URL, 'og.png');
3739
image: ogImageUrl,
3840
}}
3941
extend={{
40-
link: [{ rel: 'icon', href: '/favicon.ico' }],
42+
link: [{ rel: 'icon', href: favicon }],
4143
}}
4244
/>
4345
</head>

2025/src/pages/index.astro

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

0 commit comments

Comments
 (0)