diff --git a/src/app/[locale]/layout.tsx b/src/app/[locale]/layout.tsx index 333c093..02bac63 100644 --- a/src/app/[locale]/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -6,10 +6,68 @@ import { getLocale, Lang } from "@/i18n/locales"; import Head from 'next/head'; import { ThemeProvider } from "@/components/providers"; +import { translations } from "@/i18n/translations"; import { Oxanium } from "next/font/google"; import { headers } from "next/headers"; const oxanium = Oxanium({ subsets: ["latin-ext"] }) +import type { Metadata } from 'next'; + + +type Props = { + params: Promise<{ locale: Lang }> + searchParams: Promise<{ [key: string]: string | string[] | undefined }> +} + +export async function generateMetadata( + { params }: Props, +): Promise { + // read route params + const locale = (await params).locale + + const currentLang = getLocale(locale); + + const t = translations[currentLang]; + + return { + title: "CebulaCamp", + description: "An amazing gathering of hackers and open source enthusiasts.", + icons: { + icon: [ + { url: '/favicon-96x96.png', type: 'image/png' }, + { url: '/favicon.svg', type: 'image/svg+xml' }, + { url: '/favicon.ico', type: 'image/x-icon' } + ], + apple: '/apple-touch-icon.png', + }, + manifest: '/site.webmanifest', + other: { + 'apple-mobile-web-app-title': t.siteTitle, + }, + openGraph: { + title: t.siteTitle, + description: 'An amazing gathering of hackers and open source enthusiasts.', + url: 'https://cebula.camp', + images: [ + { + url: 'https://cebula.camp/web-app-manifest-512x512.png', + width: 512, + height: 512, + alt: t.siteTitle, + }, + ], + siteName: t.siteTitle, + type: 'website', + }, + twitter: { + card: 'summary_large_image', + title: 'CebulaCamp', + description: 'An amazing gathering of hackers and open source enthusiasts.', + images: ['https://cebula.camp/web-app-manifest-512x512.png'], + }, + }; +} + export default async function RootLayout({ children, @@ -32,15 +90,19 @@ export default async function RootLayout({ const currentLang = getLocale(locale); const defaultTheme = isDarkOrLight ? preferedTheme : "dark"; + const t = translations[currentLang]; + return ( + {t.siteTitle} + diff --git a/src/components/nav.tsx b/src/components/nav.tsx index e37c9f1..c6fda2f 100644 --- a/src/components/nav.tsx +++ b/src/components/nav.tsx @@ -70,10 +70,7 @@ export function Nav({
- - - -

{t.siteTitle}

+

{t.nav.title}

diff --git a/src/components/ui/language-selector.tsx b/src/components/ui/language-selector.tsx index b69ed3e..6ed8e55 100644 --- a/src/components/ui/language-selector.tsx +++ b/src/components/ui/language-selector.tsx @@ -8,10 +8,11 @@ import { useParams } from "next/navigation"; export const LanguageSelector = () => { const params = useParams<{ locale: Lang }>(); + const lang = params?.locale || 'pl'; - const hash = window?.location?.hash || ''; + const hash = globalThis?.window?.location?.hash || ''; if (lang === 'pl') return (<> - 🇬🇧); + 🇬🇧); if (lang === 'en') return (<> - 🇵🇱); + 🇵🇱); }; diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts index 86d9f32..8eaec9c 100644 --- a/src/i18n/translations.ts +++ b/src/i18n/translations.ts @@ -4,8 +4,9 @@ const common = { }; const pl = { - siteTitle: "CEBULACAMP", + siteTitle: "CebulaCamp", nav: { + title: "CEBULACAMP", hero: "Cebula", about: "O nas", when: "Kiedy", @@ -65,8 +66,9 @@ const pl = { }; const en = { - siteTitle: "CEBULACAMP", + siteTitle: "CebulaCamp 2025", nav: { + title: "CEBULACAMP", hero: "Onion", about: "About us", when: "When",