mirror of
https://github.com/shadcn-ui/taxonomy
synced 2026-05-24 09:48:32 +00:00
feat: use doc description for og heading
This commit is contained in:
parent
4a9b412fd9
commit
0629b9edad
2 changed files with 12 additions and 3 deletions
|
|
@ -1,5 +1,14 @@
|
|||
import { allDocs } from "contentlayer/generated"
|
||||
|
||||
import MdxHead from "@/components/docs/mdx-head"
|
||||
|
||||
export default function Head({ params }) {
|
||||
return <MdxHead params={params} og={{ type: "Documentation" }} />
|
||||
const slug = params?.slug?.join("/") || ""
|
||||
const doc = allDocs.find((doc) => doc.slugAsParams === slug)
|
||||
return (
|
||||
<MdxHead
|
||||
params={params}
|
||||
og={{ heading: doc.description, type: "Documentation" }}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ export default function MdxHead({ params, og }: MdxHeadProps) {
|
|||
let ogUrl = new URL(`${url}/og.jpg`)
|
||||
|
||||
if (og.type) {
|
||||
ogUrl = new URL(url)
|
||||
ogUrl.searchParams.set("heading", mdxDoc.title)
|
||||
ogUrl = new URL(`${url}/api/og`)
|
||||
ogUrl.searchParams.set("heading", og.heading || mdxDoc.title)
|
||||
ogUrl.searchParams.set("type", og.type)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue