35 lines
1.6 KiB
JavaScript
35 lines
1.6 KiB
JavaScript
/**
|
|
* 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 function buildNoindexField(args = {}) {
|
|
const { name = 'noindex', description = 'Check to exclude this page from indexing (robots: noindex, follow), the sitemap, llms.txt and site search.', label = 'Exclude from indexing (noindex)', overrides = {} } = args;
|
|
const { admin: adminOverrides, ...restOverrides } = overrides;
|
|
return {
|
|
name,
|
|
type: 'checkbox',
|
|
admin: {
|
|
description,
|
|
position: 'sidebar',
|
|
...adminOverrides
|
|
},
|
|
defaultValue: false,
|
|
label,
|
|
...restOverrides
|
|
};
|
|
}
|
|
|
|
//# sourceMappingURL=buildNoindexField.js.map
|