refactor: use Astro i18n to avoid redirect notice
This commit is contained in:
7
Caddyfile
Normal file
7
Caddyfile
Normal file
@@ -0,0 +1,7 @@
|
||||
:3000 {
|
||||
root * /srv
|
||||
file_server
|
||||
|
||||
@root path /
|
||||
redir @root /zh-CN/ 302
|
||||
}
|
||||
@@ -8,5 +8,6 @@ RUN pnpm build
|
||||
|
||||
FROM caddy:2-alpine AS runtime
|
||||
COPY --from=builder /app/dist /srv
|
||||
COPY Caddyfile /etc/caddy/Caddyfile
|
||||
EXPOSE 3000
|
||||
CMD ["caddy", "file-server", "--root", "/srv", "--listen", ":3000"]
|
||||
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
||||
|
||||
@@ -7,14 +7,12 @@ export default defineConfig({
|
||||
site: 'https://meetup.nixos-cn.org',
|
||||
vite: {
|
||||
plugins: [tailwindcss()],
|
||||
preview: {
|
||||
allowedHosts: ['test.nix.org.cn', 'nix.org.cn'],
|
||||
},
|
||||
},
|
||||
server: {
|
||||
host: true,
|
||||
},
|
||||
redirects: {
|
||||
'/': '/zh-CN/',
|
||||
i18n: {
|
||||
locales: ['zh-CN', 'en'],
|
||||
defaultLocale: 'zh-CN',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
---
|
||||
import CmsGuidePage from '../../components/CmsGuidePage.astro';
|
||||
import { getLocalePaths, type Locale } from '../../i18n/config';
|
||||
|
||||
export const getStaticPaths = getLocalePaths;
|
||||
|
||||
const { lang } = Astro.params as { lang: Locale };
|
||||
---
|
||||
|
||||
<CmsGuidePage locale={lang} />
|
||||
@@ -1,10 +0,0 @@
|
||||
---
|
||||
import EventGuidePage from '../../components/EventGuidePage.astro';
|
||||
import { getLocalePaths, type Locale } from '../../i18n/config';
|
||||
|
||||
export const getStaticPaths = getLocalePaths;
|
||||
|
||||
const { lang } = Astro.params as { lang: Locale };
|
||||
---
|
||||
|
||||
<EventGuidePage locale={lang} />
|
||||
@@ -1,10 +0,0 @@
|
||||
---
|
||||
import HomePage from '../../components/HomePage.astro';
|
||||
import { getLocalePaths, type Locale } from '../../i18n/config';
|
||||
|
||||
export const getStaticPaths = getLocalePaths;
|
||||
|
||||
const { lang } = Astro.params as { lang: Locale };
|
||||
---
|
||||
|
||||
<HomePage locale={lang} />
|
||||
@@ -1,10 +0,0 @@
|
||||
---
|
||||
import SouvenirPage from '../../components/SouvenirPage.astro';
|
||||
import { getLocalePaths, type Locale } from '../../i18n/config';
|
||||
|
||||
export const getStaticPaths = getLocalePaths;
|
||||
|
||||
const { lang } = Astro.params as { lang: Locale };
|
||||
---
|
||||
|
||||
<SouvenirPage locale={lang} />
|
||||
5
src/pages/en/cms-guide.astro
Normal file
5
src/pages/en/cms-guide.astro
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
import CmsGuidePage from '../../components/CmsGuidePage.astro';
|
||||
---
|
||||
|
||||
<CmsGuidePage locale='en' />
|
||||
5
src/pages/en/event-guide.astro
Normal file
5
src/pages/en/event-guide.astro
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
import EventGuidePage from '../../components/EventGuidePage.astro';
|
||||
---
|
||||
|
||||
<EventGuidePage locale='en' />
|
||||
5
src/pages/en/index.astro
Normal file
5
src/pages/en/index.astro
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
import HomePage from '../../components/HomePage.astro';
|
||||
---
|
||||
|
||||
<HomePage locale='en' />
|
||||
5
src/pages/en/souvenir.astro
Normal file
5
src/pages/en/souvenir.astro
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
import SouvenirPage from '../../components/SouvenirPage.astro';
|
||||
---
|
||||
|
||||
<SouvenirPage locale='en' />
|
||||
5
src/pages/zh-CN/cms-guide.astro
Normal file
5
src/pages/zh-CN/cms-guide.astro
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
import CmsGuidePage from '../../components/CmsGuidePage.astro';
|
||||
---
|
||||
|
||||
<CmsGuidePage locale='zh-CN' />
|
||||
5
src/pages/zh-CN/event-guide.astro
Normal file
5
src/pages/zh-CN/event-guide.astro
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
import EventGuidePage from '../../components/EventGuidePage.astro';
|
||||
---
|
||||
|
||||
<EventGuidePage locale='zh-CN' />
|
||||
5
src/pages/zh-CN/index.astro
Normal file
5
src/pages/zh-CN/index.astro
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
import HomePage from '../../components/HomePage.astro';
|
||||
---
|
||||
|
||||
<HomePage locale='zh-CN' />
|
||||
5
src/pages/zh-CN/souvenir.astro
Normal file
5
src/pages/zh-CN/souvenir.astro
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
import SouvenirPage from '../../components/SouvenirPage.astro';
|
||||
---
|
||||
|
||||
<SouvenirPage locale='zh-CN' />
|
||||
Reference in New Issue
Block a user