Skip to content

Commit

Permalink
Metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
lerte committed Jun 1, 2024
1 parent 766ef3e commit 0658210
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions apps/docs/src/app/(docs)/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ type PageProps = {
slug: string[]
}
}

export const generateMetadata = ({ params }: PageProps) => {
const { slug } = params
const docs = getDocData(slug)

return {
title: docs?.title,
description: docs?.description
}
}

export async function generateStaticParams() {
const slugs = getAllDocSlugs()
return slugs
Expand Down
6 changes: 6 additions & 0 deletions apps/docs/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import Link from 'next/link'
import Logo from '@/components/Logo'
import SyntaxHighlighter from '@/components/SyntaxHighlighter'

export const generateMetadata = () => {
return {
title: 'Actify — 🌻React Material Design 3 Components Library'
}
}

export default function Page() {
return (
<main className="col-start-1 col-end-3 bg-surface">
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/lib/doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ export function getDocData(slugs: string[]) {

return {
content: matterResult.content,
...(matterResult.data as { title: string })
...(matterResult.data as { title: string; description?: string })
}
}

0 comments on commit 0658210

Please sign in to comment.