Metadata Helper
Generate Next-compatible metadata from resolved docs routes.
Metadata Helper
Use metadata helpers from the /next export after resolving a docs route.
1import {2 getPayloadMarkdownDocsMetadata,3 resolvePayloadMarkdownDocsRoute,4} from '@valkyrianlabs/payload-markdown-docs/next'5 6const resolved = await resolvePayloadMarkdownDocsRoute({7 payload,8 slug,9})10 11const metadata = resolved ? getPayloadMarkdownDocsMetadata(resolved) : {}
Metadata returns root title / description plus OpenGraph and Twitter fields
when values are available. It uses:
- doc title and description
- docs set
meta.title,meta.description, andmeta.image - docs set nav title, title, and description
- docs group title and description
Docs pages inherit the docs set OpenGraph image unless the resolved doc has a
hero image. Doc title and description override docs set SEO title and
description. Twitter metadata uses summary_large_image when an image is
available.
See overrides for per-doc SEO fields.