import type { BasePayload } from 'payload'; import type { ContentOption } from '../content/index.js'; import type { I18nConfig } from '../i18n/index.js'; import type { PageMetadata } from './buildMetadata.js'; type CreatePageMetadataArgs = { /** Absolute site origin, e.g. 'https://example.com'. */ baseUrl?: string; /** Collection holding pages. Defaults to 'pages'. */ collection?: string; config: I18nConfig; /** * Archive-backed collections, same value as the plugin option. Pass it and * entry URLs (/pl/artykuly/moj-post) get correct canonical and hreflang; * omit it and only pages are handled. */ content?: ContentOption; /** SiteSettings global slug. Defaults to 'site-settings'. */ settingsSlug?: string; /** Field on SiteSettings holding the site name. Defaults to 'siteName'. */ siteNameField?: string; }; type PageMetadataContext = { locale: string; /** * Page number from ?page= on an archive listing. Pass it and page 2 gets a * canonical to itself; leave it out and every page claims to be page 1. */ page?: number; payload: BasePayload; /** Route slug segments; empty/undefined means the locale root. */ slug?: string[]; }; /** * Metadata for the page route, with every resolver already wired. * * `createMetadataGenerator` asks the client for resolvers because it can't know * their collections. But for the plugin's own conventions it does know: pages * live in one collection, the site name sits on SiteSettings, the OG image sits * on the plugin-seo `meta` group, the home page is whatever System Pages points * at, and — with `content` — entries live under their collection's archive page. * Re-declaring all that in every project is copy-paste, so this resolves it. * * Reach for `createMetadataGenerator` instead when a route doesn't follow those * conventions — custom image logic, a different global, hand-rolled paths. * * The plugin never calls getPayload, and Next calls generateMetadata without a * payload, so the client keeps a small wrapper: * * ```ts * const pageMetadata = createPageMetadata({ config: i18nConfig, baseUrl, content }) * * export async function generateMetadata({ params }) { * const { locale, slug } = await params * return pageMetadata({ payload: await getPayload({ config }), locale, slug }) * } * ``` */ export declare function createPageMetadata(args: CreatePageMetadataArgs): ({ slug, locale, page, payload, }: PageMetadataContext) => Promise; export {};