32 lines
1.5 KiB
TypeScript
32 lines
1.5 KiB
TypeScript
import type { CheckboxField, Field } from 'payload';
|
|
type BuildNoindexFieldArgs = {
|
|
/** Help text under the checkbox. */
|
|
description?: string;
|
|
/** Sidebar label. Default 'Exclude from indexing (noindex)'. */
|
|
label?: string;
|
|
/** Field name for the editor-facing checkbox. Default 'noindex'. */
|
|
name?: string;
|
|
/** Extend/override the generated checkbox (position, access, etc.). */
|
|
overrides?: Partial<CheckboxField>;
|
|
};
|
|
/**
|
|
* A top-level sidebar `noindex` checkbox. When ticked, the page is excluded from
|
|
* `sitemap.xml`, `llms.txt`, site search, and gets `robots: noindex, follow` —
|
|
* ALL automatically, no per-project filtering.
|
|
*
|
|
* Why top-level (not mirrored into `meta.noindex`): plugin-seo's `meta` group
|
|
* declares only title/description/image, so Payload silently strips any extra
|
|
* key (`meta.noindex`) during sanitization — an earlier version mirrored there
|
|
* and the value vanished, leaking noindex pages into the sitemap. The value now
|
|
* lives on this top-level field, which persists; every reader in the kit
|
|
* (buildSitemapEntries, buildMetadata/createPageMetadata, buildLlmsTxt,
|
|
* searchContent) checks `doc.noindex` (and still tolerates a legacy
|
|
* `meta.noindex`). One field, one source of truth, zero project glue.
|
|
*
|
|
* // collections/Pages.ts
|
|
* import { buildNoindexField } from '@intecion/ipal-kit'
|
|
* fields: [ /* … *\/ buildNoindexField() ],
|
|
*/
|
|
export declare function buildNoindexField(args?: BuildNoindexFieldArgs): Field;
|
|
export {};
|