diff --git a/website/app/components/[id]/layout.tsx b/website/app/components/[id]/layout.tsx index facfb0233..ce011e7f4 100644 --- a/website/app/components/[id]/layout.tsx +++ b/website/app/components/[id]/layout.tsx @@ -19,6 +19,18 @@ type LayoutProps = { } } +export async function generateMetadata({ params }: { params: { [key: string]: string } }) { + const { id } = params + const { data } = getPageContent(`${getRepository(id)}/docs/index.mdx`, true) + const title = data?.title + const description = data?.description + + return { + title: `Welcome UI - ${title}`, + description: description, + } +} + const Layout = ({ children, params }: LayoutProps) => { const pages = getPages() const { id } = params diff --git a/website/app/components/page.tsx b/website/app/components/page.tsx index 8962ec9fd..34c9b9111 100644 --- a/website/app/components/page.tsx +++ b/website/app/components/page.tsx @@ -4,11 +4,16 @@ import { Flex } from '@welcome-ui/flex' import { Grid } from '@welcome-ui/grid' import { Text } from '@welcome-ui/text' import { Box } from '@welcome-ui/box' +import { Metadata } from 'next' import { getPages } from '@/build-app/utils/pages-components' import { getName, getRepository } from '@/build-app/utils/transform-name' import { getPageContent } from '@/build-app/utils/page-content' +export const metadata: Metadata = { + title: 'Welcome UI - Components', +} + const Page = () => { const pages = getPages() diff --git a/website/app/foundations/[id]/page.tsx b/website/app/foundations/[id]/page.tsx index c311dddaa..bb913f74b 100644 --- a/website/app/foundations/[id]/page.tsx +++ b/website/app/foundations/[id]/page.tsx @@ -5,6 +5,7 @@ import { TableOfContent } from '@/build-app/components/TableOfContent' import { getPageContent } from '@/build-app/utils/page-content' import { getPages, getStaticParams } from '@/build-app/utils/pages-exports' import { PrevNextPage } from '@/build-app/components/PrevNextPage' +import { getName } from '@/build-app/utils/transform-name' type PageProps = { params: { @@ -12,6 +13,15 @@ type PageProps = { } } +export async function generateMetadata({ params }: { params: { [key: string]: string } }) { + const { id } = params + const title = getName(id) + + return { + title: `Welcome UI - ${title}`, + } +} + export async function generateStaticParams() { const pages = getPages('foundations') diff --git a/website/app/layout.tsx b/website/app/layout.tsx index d859395a0..4b3792710 100644 --- a/website/app/layout.tsx +++ b/website/app/layout.tsx @@ -29,7 +29,7 @@ const RootLayout = ({ children }: { children: React.ReactNode }) => { return (
- +