SEO: multilingual homepage (homeSlug per locale in path/sitemap), Article + llms.txt generators, siteDescription fallback, composeTitle dedup

This commit is contained in:
2026-09-15 21:16:53 +02:00
parent 55a1e5bf8f
commit 0f03bb7446
5 changed files with 283 additions and 61 deletions
+22 -16
View File
@@ -1,8 +1,14 @@
import type { BasePayload, SanitizedConfig } from 'payload';
import type { ContentOption, ResolvedRoute, ArchiveEntries } from '../content/index.js';
import type { ArchiveEntries, ContentOption, ResolvedRoute } from '../content/index.js';
import type { I18nConfig } from '../i18n/index.js';
import type { SitemapEntry, RobotsRules } from '../seo/index.js';
import type { RobotsRules, SitemapEntry } from '../seo/index.js';
type CreateContentHelpersArgs = {
/**
* Absolute site origin for sitemap/robots URLs. Falls back to
* NEXT_PUBLIC_SERVER_URL, then to a relative origin (which most crawlers
* reject, so set one in production).
*/
baseUrl?: string;
/**
* The client's payload config promise (the default export of payload.config).
* Passed in because the plugin never imports the client's config directly.
@@ -10,21 +16,15 @@ type CreateContentHelpersArgs = {
config: Promise<SanitizedConfig> | SanitizedConfig;
/** Archive-backed collections, same value as the plugin option. */
content?: ContentOption;
/** SiteSettings global slug. Defaults to 'site-settings'. */
settingsSlug?: string;
/** Pages collection slug. Defaults to 'pages'. */
pagesSlug?: string;
/**
* i18n config. Required only if you want the ready-made `sitemap` / `robots`
* handlers — they need the locale list to emit hreflang.
*/
i18n?: I18nConfig;
/**
* Absolute site origin for sitemap/robots URLs. Falls back to
* NEXT_PUBLIC_SERVER_URL, then to a relative origin (which most crawlers
* reject, so set one in production).
*/
baseUrl?: string;
/** Pages collection slug. Defaults to 'pages'. */
pagesSlug?: string;
/** SiteSettings global slug. Defaults to 'site-settings'. */
settingsSlug?: string;
};
/**
* Bundles the per-request data helpers a frontend needs — the same cached
@@ -52,13 +52,19 @@ type CreateContentHelpersArgs = {
* a URL is, fetching gets the listing. Metadata generation needs the first and
* not the second, and a page component composes them in two obvious lines.
*/
export declare function createContentHelpers({ config, content, settingsSlug, pagesSlug, i18n, baseUrl, }: CreateContentHelpersArgs): {
export declare function createContentHelpers({ baseUrl, config, content, i18n, pagesSlug, settingsSlug, }: CreateContentHelpersArgs): {
generateStaticParams: () => Promise<Array<{
locale: string;
slug: string[];
} | {
slug: string[];
}>>;
getCachedPayload: () => Promise<BasePayload>;
getConfiguredLocales: () => Promise<string[]>;
getSettings: (locale: string) => Promise<import("payload").JsonObject>;
resolveRoute: (locale: string, segments: string[] | undefined, page: number) => Promise<ResolvedRoute | null>;
getEntries: (collection: string, locale: string, page: number, perPage: number) => Promise<ArchiveEntries>;
sitemap: () => Promise<SitemapEntry[]>;
getSettings: (locale: string) => Promise<import("payload").JsonObject>;
resolveRoute: (locale: string, segments: string[] | undefined, page: number) => Promise<null | ResolvedRoute>;
robots: () => RobotsRules;
sitemap: () => Promise<SitemapEntry[]>;
};
export {};