|
1 | 1 | import type { Metadata } from "next"; |
2 | 2 | import "../globals.css"; |
3 | | -import { getTranslations } from "next-intl/server"; |
| 3 | +import { getTranslations, setRequestLocale } from "next-intl/server"; |
4 | 4 |
|
5 | | -const locale = 'zh-tw'; |
6 | | -const t = await getTranslations({ locale, namespace: 'Metadata' }); |
| 5 | +export async function generateMetadata({}: {params: Promise<{locale: string}>}){ |
| 6 | + const locale = 'zh-tw'; |
| 7 | + const t = await getTranslations({ locale, namespace: 'Metadata' }); |
7 | 8 |
|
8 | | -export const metadata: Metadata = { |
9 | | - icons: [{ rel: "icon", url: "/logo/twds_circle.svg" }], |
10 | | - title: t('title'), |
11 | | - description: t('description'), |
12 | | - keywords: "networking, security, open source, sustainability, technology, startups, future, Taiwan, sustainability, education, cybersecurity", |
13 | | - authors: [{ name: "Taiwan Digital Streaming Co." }], |
14 | | - openGraph: { |
| 9 | + return { |
| 10 | + icons: [{ rel: "icon", url: "/logo/twds_circle.svg" }], |
15 | 11 | title: t('title'), |
16 | 12 | description: t('description'), |
17 | | - type: "website", |
18 | | - locale: locale === 'zh-tw' ? 'zh_TW' : 'en_US', |
19 | | - url: "https://www.twds.com.tw/", |
20 | | - images: "https://www.twds.com.tw/img/og.png", |
21 | | - }, |
22 | | - twitter: { |
23 | | - card: "summary_large_image", |
24 | | - title: t('title'), |
25 | | - description: t('description'), |
26 | | - }, |
27 | | -}; |
| 13 | + keywords: "networking, security, open source, sustainability, technology, startups, future, Taiwan, sustainability, education, cybersecurity", |
| 14 | + authors: [{ name: "Taiwan Digital Streaming Co." }], |
| 15 | + openGraph: { |
| 16 | + title: t('title'), |
| 17 | + description: t('description'), |
| 18 | + type: "website", |
| 19 | + locale: locale === 'zh-tw' ? 'zh_TW' : 'en_US', |
| 20 | + url: "https://www.twds.com.tw/", |
| 21 | + images: "https://www.twds.com.tw/img/og.png", |
| 22 | + }, |
| 23 | + twitter: { |
| 24 | + card: "summary_large_image", |
| 25 | + title: t('title'), |
| 26 | + description: t('description'), |
| 27 | + }, |
| 28 | + }; |
| 29 | +} |
28 | 30 |
|
29 | 31 | export default function RootLayout({ |
30 | 32 | children, |
31 | 33 | }: Readonly<{ |
32 | 34 | children: React.ReactNode; |
33 | 35 | }>) { |
| 36 | + setRequestLocale('zh-tw'); |
34 | 37 | return ( |
35 | 38 | <html lang="zh-TW"> |
36 | 39 | <body> |
|
0 commit comments