Files
shadcn-ui/apps/www/app/docs/[[...slug]]/head.tsx
2023-01-24 19:51:29 +04:00

26 lines
478 B
TypeScript

import { allDocs } from "contentlayer/generated"
import MdxHead from "@/components/mdx-head"
interface HeadProps {
params: {
slug: string[]
}
}
export default function Head({ params }: HeadProps) {
const slug = params?.slug?.join("/") || ""
const doc = allDocs.find((doc) => doc.slugAsParams === slug)
if (!doc) {
return null
}
return (
<MdxHead
params={params}
og={{ heading: doc.title, type: doc.title, mode: "light" }}
/>
)
}