Revert "A development host is kept out of search engines without IAPL_NOINDEX (developmentNoindex, default on)"

This reverts commit bc3aac249f.
This commit is contained in:
Radosław Smoliński
2026-11-26 10:38:29 +01:00
parent 463b966365
commit 5df5358768
23 changed files with 24 additions and 215 deletions
-18
View File
@@ -42,21 +42,3 @@ export function matchDevelopmentHost(host: null | string | undefined, patterns:
/** Is `host` a development address (`matchDevelopmentHost` as a yes or no)? */
export const isDevelopmentHost = (host: null | string | undefined, patterns: readonly string[] = DEFAULT_DEVELOPMENT_HOSTS): boolean =>
matchDevelopmentHost(host, patterns) !== null
// What `iapl({ developmentHosts, developmentNoindex })` set for this process — read by the helpers that run
// without a Payload config at hand (robots, metadata, IndexNow). `next.config` runs before the plugin: there,
// `buildSecurityHeaders({ developmentHosts })` takes the same list when the project changed it.
let configured: { hosts?: readonly string[]; noindex?: boolean } = {}
/** Called by the plugin with its options; a later call replaces the earlier one. */
export function configureDevelopmentHosts(options: { hosts?: readonly string[]; noindex?: boolean } = {}): void {
configured = { ...(options.hosts ? { hosts: [...options.hosts] } : {}), ...(options.noindex === false ? { noindex: false } : {}) }
}
/**
* The patterns whose hosts are kept out of search engines by default: the plugin's development hosts, or
* `false` when the project switched that off (`iapl({ developmentNoindex: false })`).
*/
export function noindexDevelopmentHosts(): false | readonly string[] {
return configured.noindex === false ? false : (configured.hosts ?? DEFAULT_DEVELOPMENT_HOSTS)
}