Admin panel in English and Polish, reworded per docs/dev/admin-ux.md
- admin-i18n module: AdminText { en, pl }, component texts under the ipal
namespace (project translations win), en + pl admin languages when the
project sets none (project's supportedLanguages wins)
- every plugin label, description, option, tab and group as { en, pl };
explicit labels instead of auto-labels; sentence case; glossary terms
- visible renames (slugs, names, data unchanged): Cookie banner, Form
messages, Privacy group, Search engines, Maintenance, Spam protection,
E-mail sending, stats nav link Overview (hidden without access)
- Polish visitor defaults by page locale: cookie banner, form messages,
validators, lightbox, accessibility widget; {field} uses the label
- fixes: e-mail status banner used Turnstile wording; developer words and
env var names out of editor messages; stats numbers/dates in the admin
language; test e-mail no longer says ipal-kit
- test/adminUx.test.ts: length limits, en + pl present, no developer words
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
eeac33ed2f
commit
6b46bc0c14
@@ -1,9 +1,10 @@
|
||||
import type { Field } from 'payload'
|
||||
|
||||
import type { AdminText } from '../admin-i18n/index.js'
|
||||
import type { AiBotRule, AiBotsPolicy, RobotsOptions } from './buildRobots.js'
|
||||
|
||||
/**
|
||||
* Site Settings → Search & AI: what editors set for search engines and AI
|
||||
* Site settings → Search engines: what editors set for search engines and AI
|
||||
* assistants without a deploy — Search Console / Bing verification codes, the
|
||||
* AI crawler policy for robots.txt, and a note for llms.txt. Empty fields
|
||||
* change nothing: verification tags appear only once a code is pasted, and the
|
||||
@@ -36,87 +37,122 @@ export function normalizeVerificationToken(raw: unknown): string {
|
||||
return /^[\w\-.:+/=]{1,200}$/.test(value) ? value : ''
|
||||
}
|
||||
|
||||
const tokenField = (name: string, label: string, description: string): Field => ({
|
||||
const tokenField = (name: string, product: string, description: AdminText): Field => ({
|
||||
name,
|
||||
type: 'text',
|
||||
admin: { description },
|
||||
hooks: { beforeChange: [({ value }) => normalizeVerificationToken(value) || null] },
|
||||
label,
|
||||
// A product name reads the same in every language.
|
||||
label: { en: product, pl: product },
|
||||
})
|
||||
|
||||
const AI_POLICY_OPTIONS = [
|
||||
{ label: 'As set by the developer (default)', value: 'default' },
|
||||
{ label: 'Allow all AI assistants and AI training', value: 'allow' },
|
||||
{ label: 'Allow AI assistants and AI search, block AI training', value: 'block-training' },
|
||||
{ label: 'Block all known AI bots', value: 'disallow' },
|
||||
] as const
|
||||
const AI_POLICY_OPTIONS: { label: AdminText; value: string }[] = [
|
||||
{ label: { en: 'Default setting', pl: 'Ustawienie domyślne' }, value: 'default' },
|
||||
{ label: { en: 'Allow all, including AI training', pl: 'Zezwól na wszystko, także trening AI' }, value: 'allow' },
|
||||
{ label: { en: 'Allow assistants, block training', pl: 'Zezwól asystentom, blokuj trening' }, value: 'block-training' },
|
||||
{ label: { en: 'Block all AI services', pl: 'Blokuj wszystkie usługi AI' }, value: 'disallow' },
|
||||
]
|
||||
|
||||
/** The "Search & AI" tab fields. Not localized, except the llms.txt note. */
|
||||
/**
|
||||
* The "Search engines" tab fields. Not localized, except the llms.txt note.
|
||||
* Order (admin-ux §7): the note (content) first, then verification codes and
|
||||
* the AI access policy with its per-bot rules.
|
||||
*/
|
||||
export const searchSettingsFields: Field[] = [
|
||||
{
|
||||
name: LLMS_INTRO_FIELD,
|
||||
type: 'textarea',
|
||||
admin: {
|
||||
description: {
|
||||
en: 'Key facts AI assistants may quote: what you do, where, for whom and since when.',
|
||||
pl: 'Najważniejsze fakty, które asystenci AI mogą cytować: czym zajmuje się firma, gdzie, dla kogo i od kiedy.',
|
||||
},
|
||||
},
|
||||
label: { en: 'Site summary (llms.txt)', pl: 'Opis witryny (llms.txt)' },
|
||||
localized: true,
|
||||
},
|
||||
{
|
||||
name: SEARCH_VERIFICATION_FIELD,
|
||||
type: 'group',
|
||||
admin: {
|
||||
description:
|
||||
'Proves to search engines that you own this site. Paste the code (or the whole <meta> tag) from the search engine; it is added to every page. Leave empty if you verify another way (DNS, file).',
|
||||
description: {
|
||||
en: 'Paste the code or the whole meta tag from each tool; leave empty if you verify by DNS.',
|
||||
pl: 'Wklej kod lub cały znacznik meta z narzędzia; zostaw puste przy weryfikacji przez DNS.',
|
||||
},
|
||||
},
|
||||
fields: [
|
||||
tokenField('google', 'Google Search Console', 'Search Console → Settings → Ownership verification → HTML tag.'),
|
||||
tokenField('bing', 'Bing Webmaster Tools', 'Bing Webmaster Tools → Add site → HTML Meta Tag (msvalidate.01). Bing also powers ChatGPT Search and Copilot.'),
|
||||
tokenField('yandex', 'Yandex Webmaster', 'Yandex Webmaster → Site verification → Meta tag.'),
|
||||
tokenField('google', 'Google Search Console', {
|
||||
en: 'Find it under Settings, Ownership verification, HTML tag.',
|
||||
pl: 'Kod znajduje się w: Ustawienia, Weryfikacja własności, Tag HTML.',
|
||||
}),
|
||||
tokenField('bing', 'Bing Webmaster Tools', {
|
||||
en: 'Find it under Add site, HTML Meta Tag; Bing also feeds ChatGPT Search and Copilot.',
|
||||
pl: 'Kod znajduje się w: Dodaj witrynę, Tag meta HTML; z Bing korzystają też ChatGPT Search i Copilot.',
|
||||
}),
|
||||
tokenField('yandex', 'Yandex Webmaster', {
|
||||
en: 'Find it under Site verification, Meta tag.',
|
||||
pl: 'Kod znajduje się w: Weryfikacja witryny, Tag meta.',
|
||||
}),
|
||||
],
|
||||
label: 'Search engine verification',
|
||||
label: { en: 'Site verification', pl: 'Weryfikacja witryny' },
|
||||
},
|
||||
{
|
||||
name: AI_CRAWLERS_FIELD,
|
||||
type: 'group',
|
||||
admin: {
|
||||
description:
|
||||
'Which AI bots may read the site (robots.txt). Assistants (ClaudeBot, ChatGPT-User, PerplexityBot…) fetch pages to answer questions and cite you; training crawlers (GPTBot, Google-Extended, CCBot…) collect pages to train models. Blocking assistants removes the site from AI answers.',
|
||||
description: {
|
||||
en: 'Which AI services may read the site; blocking assistants removes it from AI answers.',
|
||||
pl: 'Które usługi AI mogą czytać witrynę; zablokowanie asystentów usuwa ją z odpowiedzi AI.',
|
||||
},
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'policy',
|
||||
type: 'select',
|
||||
defaultValue: 'default',
|
||||
label: 'AI bots',
|
||||
label: { en: 'Access', pl: 'Dostęp' },
|
||||
options: AI_POLICY_OPTIONS.map((o) => ({ ...o })),
|
||||
},
|
||||
{
|
||||
name: 'rules',
|
||||
type: 'array',
|
||||
admin: {
|
||||
description:
|
||||
'Exceptions for single bots, by user agent exactly as the bot announces itself (e.g. GPTBot, Bytespider). Wins over the setting above.',
|
||||
description: {
|
||||
en: 'Exceptions for single bots by name, e.g. GPTBot; they override the setting above.',
|
||||
pl: 'Wyjątki dla pojedynczych botów według nazwy, np. GPTBot; mają pierwszeństwo przed ustawieniem powyżej.',
|
||||
},
|
||||
initCollapsed: true,
|
||||
},
|
||||
fields: [
|
||||
{ name: 'userAgent', type: 'text', label: 'User agent', required: true },
|
||||
{
|
||||
name: 'access',
|
||||
type: 'select',
|
||||
defaultValue: 'disallow',
|
||||
options: [
|
||||
{ label: 'Allow', value: 'allow' },
|
||||
{ label: 'Block', value: 'disallow' },
|
||||
type: 'row',
|
||||
fields: [
|
||||
{
|
||||
name: 'userAgent',
|
||||
type: 'text',
|
||||
admin: { placeholder: 'GPTBot' },
|
||||
label: { en: 'Bot name', pl: 'Nazwa bota' },
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'access',
|
||||
type: 'select',
|
||||
defaultValue: 'disallow',
|
||||
label: { en: 'Access', pl: 'Dostęp' },
|
||||
options: [
|
||||
{ label: { en: 'Allow', pl: 'Zezwól' }, value: 'allow' },
|
||||
{ label: { en: 'Block', pl: 'Blokuj' }, value: 'disallow' },
|
||||
],
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
label: 'Per-bot exceptions',
|
||||
label: { en: 'Bot rules', pl: 'Reguły dla botów' },
|
||||
labels: { plural: { en: 'Rules', pl: 'Reguły' }, singular: { en: 'Rule', pl: 'Reguła' } },
|
||||
},
|
||||
],
|
||||
label: 'AI crawlers',
|
||||
},
|
||||
{
|
||||
name: LLMS_INTRO_FIELD,
|
||||
type: 'textarea',
|
||||
admin: {
|
||||
description:
|
||||
'Shown at the top of /llms.txt, under the site description: key facts an AI assistant should know and may quote — what you do, where, for whom, since when. Plain sentences, no marketing slogans.',
|
||||
},
|
||||
label: 'About the site for AI assistants (llms.txt)',
|
||||
localized: true,
|
||||
label: { en: 'AI assistants', pl: 'Asystenci AI' },
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user