35 lines
1.5 KiB
TypeScript
35 lines
1.5 KiB
TypeScript
import type { CheckboxField, Field } from 'payload';
|
|
type BuildNoindexFieldArgs = {
|
|
/** Help text under the checkbox. */
|
|
description?: string;
|
|
/** Sidebar label. Default 'Wyklucz z indeksowania (noindex)'. */
|
|
label?: string;
|
|
/**
|
|
* Dotted path, inside the document, that the SEO read path (metadata +
|
|
* sitemap) consumes. Default 'meta.noindex' — the plugin-seo `meta` group.
|
|
* The checkbox value is mirrored here on every save, so editors toggle one
|
|
* friendly switch and the machinery reads a stable location.
|
|
*/
|
|
metaPath?: string;
|
|
/** Field name for the editor-facing checkbox. Default 'noindex'. */
|
|
name?: string;
|
|
/** Extend/override the generated checkbox (position, access, etc.). */
|
|
overrides?: Partial<CheckboxField>;
|
|
};
|
|
/**
|
|
* A sidebar `noindex` checkbox that mirrors into `meta.noindex` (what the
|
|
* sitemap and metadata generators actually read). Replaces the hand-rolled
|
|
* checkbox + `beforeChange` hook with its `(data as any).meta.noindex = …`
|
|
* glue copied into every project — no `any`, one source of truth for editors,
|
|
* one stable read location for the engine.
|
|
*
|
|
* Idempotent and order-independent: if either the checkbox OR an existing
|
|
* `meta.noindex` is set, the page ends up noindex; the two can't drift apart.
|
|
*
|
|
* // collections/Pages.ts
|
|
* import { buildNoindexField } from '@intecion/ipal-kit'
|
|
* fields: [ /* … *\/ buildNoindexField() ],
|
|
*/
|
|
export declare function buildNoindexField(args?: BuildNoindexFieldArgs): Field;
|
|
export {};
|