Merge main (security-perf + SEO) into docs; finish English docs and agent guide
- Resolve conflicts in analytics, consent, content, i18n, mcp and stats, keeping the docs fixes and the new code behaviour, verified against src - Translate the remaining 14 module pages, ipal-seo-check skill and script - Integrate the security-perf and SEO agent-guide text: getRobots, isPathVisible, Search & AI (DNS verification first, meta fields optional), sitemap index/cache/503, consentMode basic/advanced, policyVersion, globalOverrides, revalidatePath / buildGlobalRevalidateHook, authAccess, firstUserAdmin, allowCollectionMismatch, unknown-IP rate limit; stale claims fixed across AGENT.md, skills, frontend, developer guide, vibe - docsConsistency: pending list removed (all docs English); relative links now also check #anchors Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+52
-18
@@ -96,16 +96,17 @@ site), **P** = a test in the panel. Full code: PROGRAMISTA.md §2.
|
||||
|---|---|---|---|---|
|
||||
| 1 | i18n + routing | `src/proxy.ts`, `[locale]/[[...slug]]/page.tsx` = `createPageRoute(content, {…})` + a literal `revalidate`, `not-found.tsx` = `createNotFoundPage(content, { load })` + `notFoundView.ts` (`renderNotFoundView`) | `createProxy`, `createContentHelpers`, `createPageRoute`, `createNotFoundPage` (`/rsc`) | A, S |
|
||||
| 2 | **SEO** — meta | `generateMetadata` in every page route; favicon and OG from Site Settings; `htmlLimitedBots` in `next.config.ts`; SEO tab + `buildNoindexField` in Pages | `generatePageMetadata`, `buildIconsMetadata`, `buildNoindexField` | A, S |
|
||||
| 3 | **SEO** — maps | `src/app/sitemap.xml/route.ts`, `src/app/robots.ts`, `src/app/manifest.ts` — each is a re-export from `lib/content` (`sitemapRoute`, `robots`, `manifest`) + `force-dynamic` except robots | `sitemapRoute`, `robots`, `manifest` | A, S |
|
||||
| 3 | **SEO** — maps | `src/app/sitemap.xml/route.ts` (`export { sitemapRoute as GET }` + `force-dynamic`), `src/app/robots.ts` (`export { getRobots as default }` + `force-dynamic` — AI bots from the panel), `src/app/manifest.ts` — re-exports from `lib/content` | `sitemapRoute`, `getRobots` (or `robots` without the panel), `manifest` | A, S |
|
||||
| 3a | **Search Console / Bing** | recommended: **domain verification via DNS** (TXT record, deployment.md §6) — the plugin does nothing, the verification fields stay empty; only for URL-prefix verification: code in **Site Settings → Search & AI** (Google, Bing, Yandex), `generatePageMetadata` adds the `<meta>` itself; sitemap `https://<domain>/sitemap.xml` submitted in GSC and Bing | panel (optional), `verificationFrom` | P |
|
||||
| 4 | **SEO** — structured data | layout: `<SiteProviders shell={…}>` gives `WebSite` + `Organization` (`sameAs`) from Site Settings; local business → `createContentHelpers({ siteJsonLd })` with `buildLocalBusinessJsonLd` (`type`, hours → `formatOpeningHours`); navigation: `<SiteProviders jsonLd={[buildNavigationJsonLd(…)]}>`; page: `createPageRoute` adds `getPageJsonLd` (WebPage/BlogPosting, breadcrumbs, FAQ — `pageJsonLd: { faq }`) | `getSiteShell`, `SiteProviders`, `build*JsonLd`, `getPageJsonLd` | A, S |
|
||||
| 5 | **GEO** — llms | `src/app/llms.txt/route.ts` (`llmsRoute`) and `src/app/llms-full.txt/route.ts` (`llmsFullRoute`) from `lib/content`; the `buildSummaryField()` field in Pages, `summaryField: 'aiSummary'` in `createContentHelpers` | `llmsRoute`, `llmsFullRoute`, `buildSummaryField` | A, S |
|
||||
| 6 | **GEO** — Markdown | `src/app/md/[locale]/[[...slug]]/route.ts` (single-language: `src/app/md/[[...slug]]/route.ts`) = `export { markdownRoute as GET } from '@/lib/content'`; `createContentHelpers({ markdownAlternate: true })` (link in `<head>`); `createProxy(…, { NextResponse, markdown: true })` (without it `/md/…` gets redirected to a language) | `markdownRoute`, `markdownAlternate`, `createProxy({ markdown })` | A, S |
|
||||
| 7 | **GEO** — MCP | `src/app/api/mcp/route.ts` = `export { mcpGET as GET, mcpPOST as POST } from '@/lib/content'` (public — AI browses the site: `get_site_info`, `list_pages`, `search_content`, `get_page`); name: `createContentHelpers({ mcp: { serverName } })` | `mcpGET`, `mcpPOST` | A, S |
|
||||
| 8 | **GEO** — AI bots + IndexNow | robots **lets in** AI bots (default `aiBots: 'allow'`; block only on a client decision); `ipalKit({ indexNow: true })` + `src/app/indexnow-key.txt/route.ts` (`indexNowKeyRoute`; publishing → Bing/ChatGPT Search within minutes) | `buildRobots`, `indexNowKeyRoute` | A, S |
|
||||
| 8 | **GEO** — AI bots + IndexNow | robots **lets in** AI bots (default `aiBots: 'allow'`; block only on a client decision); AI bot policy and per-bot exceptions — Site Settings → Search & AI → AI crawlers (works only with `getRobots`); `ipalKit({ indexNow: true })` + `src/app/indexnow-key.txt/route.ts` (`indexNowKeyRoute`; publishing → Bing/ChatGPT Search within minutes; IndexNow sends nothing with `IPAL_NOINDEX=1`) | `buildRobots`, `getRobots`, `indexNowKeyRoute` | A, S |
|
||||
| 9 | **Media / R2 / speed** | `Media` with `focalPoint`, `normalizeFilenameHook`, `buildOptimizeUploadHook`, `buildMediaPlaceholderHook` + field; **always** `buildR2Storage(['media'], { s3Storage })` + `@payloadcms/storage-s3`; `R2_*` in `.env.example`; `<MediaPreconnect/>`; `images: buildImagesConfig()` and `buildUploadSecurityHeaders()` in `next.config.ts`; the project's `<Media>` via `mediaImageProps`/`videoProps` (§6.11b) | `buildR2Storage`, `mediaImageProps`, `videoProps`, `buildImagesConfig` | A, S |
|
||||
| 10 | **Forms** | every form from a **seed** (`scripts/seed-form-*.ts`: fields, confirmation, mail to the company **and** confirmation to the customer, every language); a block with `<RenderForm>` + `formClasses.ts` (look, once); `actions.ts` = `createSubmitAction({ getCachedPayload, headers })`; `forms: {…}` in `ipalKit`; `email: mailAdapter()` | `RenderForm` (`/rsc`), `createSubmitAction`, `mailAdapter` | A, P |
|
||||
| 11 | **Turnstile** | `<SiteProviders>` in `[locale]/layout.tsx` (wires `TurnstileProvider` with the key from the panel); `RenderForm` renders the widget; keys in Site Integrations | `SiteProviders`, `getTurnstileConfig`, `TurnstileProvider` | A, P |
|
||||
| 12 | Consent + analytics | `ipalKit({ consentLog: true })` (without it the `/api/ipal/consent` endpoint does not exist) + `<SiteProviders logEndpoint="/api/ipal/consent" banner={<CookieBanner equalChoice settings="detailed" />}>` (ConsentProvider, banner, CookieButton, Analytics in the right order); settings window mode (`settings`: `inline` / `modal` / `detailed`) per the design, brief is silent → `detailed`, the decision goes to "Project decisions"; tool IDs in the panel; the cookie list from a scan (cookie-scan → import) — feeds `<CookieTable>` on the policy page **and** the lists in the `detailed` window; Cookie Settings → Detail labels in every language | consent.md, analytics.md | A, `ipal-consent-check` |
|
||||
| 12 | Consent + analytics | Consent Mode: `'advanced'` (default — the Google tag loads at once with every signal `denied`) or `'basic'` (`<SiteProviders analytics={{ consentMode: 'basic' }}>` — no request to Google before consent; a client who wants zero requests), the choice goes to "Project decisions"; `ipalKit({ consentLog: true })` (without it the `/api/ipal/consent` endpoint does not exist) + `<SiteProviders logEndpoint="/api/ipal/consent" banner={<CookieBanner equalChoice settings="detailed" />}>` (ConsentProvider, banner, CookieButton, Analytics in the right order); settings window mode (`settings`: `inline` / `modal` / `detailed`) per the design, brief is silent → `detailed`, the decision goes to "Project decisions"; tool IDs in the panel; the cookie list from a scan (cookie-scan → import) — feeds `<CookieTable>` on the policy page **and** the lists in the `detailed` window; Cookie Settings → Detail labels in every language | consent.md, analytics.md | A, `ipal-consent-check` |
|
||||
| 13 | Security | `buildSecurityHeaders` in `next.config.ts`; `twoFactor: { issuer, plugin: payloadTotp }`; CSP `report-only` → `enforce`; `IPAL_IP_HEADER` in production | security.md, forms.md | A |
|
||||
| 14 | Operations | `src/app/api/health/route.ts` (`healthRoute`); `src/instrumentation.ts` with `assertEnv(ipalEnvRules({ storage: true, ipHeader: true }))`; staging with `IPAL_NOINDEX=1`; smoke tests (§8a) | `healthRoute`, `assertEnv`, `ipalEnvRules` | A |
|
||||
| 15 | System pages | Site Settings → System Pages: homepage, 404, privacy policy, cookies; legal links in the footer by role (`getSystemLinks(locale)`) | `getSystemLinks`, `getSystemPagePath`, `getNotFoundPage` | P |
|
||||
@@ -129,7 +130,8 @@ Do not make the provider or the widget conditional in code — always wire them.
|
||||
| your own `api/contact` / `api/send` / `api/form` route, `nodemailer` / `resend` / `@sendgrid` in the project | bypasses the `submitForm` validation and gates, a second mail transport | the `sendForm` server action → `submitForm`, mails from Forms → Emails via `mailAdapter()` |
|
||||
| reCAPTCHA, hCaptcha, your own captcha | a second mechanism, no status in the panel | Turnstile from the plugin |
|
||||
| a hand-written `<script type="application/ld+json">` | no escaping, drifts from the panel | `JsonLdGraph` |
|
||||
| your own `sitemap.ts` / a text `robots.txt` in `public/` | no hreflang, noindex or system pages | `sitemapRoute`, `robots` from `lib/content` |
|
||||
| your own `sitemap.ts` / a text `robots.txt` in `public/` | no hreflang, noindex or system pages | `sitemapRoute`, `getRobots` from `lib/content` |
|
||||
| a verification `<meta>` / `google*.html` file in code or `public/` | a deploy for every change; the code belongs to the client | DNS verification, or the code in Site Settings → Search & AI |
|
||||
| your own `llms.txt` in `public/` | static, goes stale | `llmsRoute` / `llmsFullRoute` from `lib/content` |
|
||||
| your own link function (`resolveHref`, `getHref`…): the homepage slug in code (`=== 'home'`), `` `/${slug}` `` | no language prefix, the homepage depends on Site Settings, `javascript:` from the panel in `href`, a dead link leads to `/` | `resolveLink(link, locale)` / `resolveNav` from `lib/content` (field: `buildLinkField`) |
|
||||
| `page` + `url` + `label` fields in globals, `prefooterButtonUrl`, `ctaLabel`; style based on content (`label === 'Tesla'`); legal link labels in code | the editor cannot choose a file / new tab / style; renaming breaks the look; Polish text in the English version | `buildLinkField` / `buildLinksField` with `appearances`, `resolveNav`, `getSystemLinks` |
|
||||
@@ -294,8 +296,8 @@ The **ipal-plugin-gap** skill: report + a minimal, marked workaround
|
||||
Real mistakes: an `afterRead` hook in Media with `https://media.klient.pl` (the plugin generates
|
||||
the URL from `R2_PUBLIC_URL`), `<link rel="preconnect">` with a hardcoded domain (the plugin has
|
||||
`<MediaPreconnect/>`), a copied `Analytics` component in the project with the consent
|
||||
gating removed (the plugin enforces consent itself — Google via Consent Mode v2, other
|
||||
pixels after consent — and late loading is `analytics={{ defer: true }}`).
|
||||
gating removed (the plugin enforces consent itself — Google via Consent Mode v2, `advanced` by default or
|
||||
`basic` with `analytics={{ consentMode: 'basic' }}`, other pixels after consent — and late loading is `analytics={{ defer: true }}`).
|
||||
|
||||
---
|
||||
|
||||
@@ -336,7 +338,7 @@ src/
|
||||
(payload)/ # admin panel (generated)
|
||||
manifest.ts # export { manifest as default } from lib/content + force-dynamic
|
||||
sitemap.xml/route.ts # export { sitemapRoute as GET } + force-dynamic (styling from the plugin)
|
||||
robots.ts # export { robots as default } (AI bots allowed)
|
||||
robots.ts # export { getRobots as default } + force-dynamic (AI bots allowed; policy from the panel)
|
||||
llms.txt/route.ts # export { llmsRoute as GET } (GEO)
|
||||
llms-full.txt/route.ts # export { llmsFullRoute as GET } (GEO)
|
||||
md/[locale]/[[...slug]]/route.ts # export { markdownRoute as GET } — the page as Markdown (GEO)
|
||||
@@ -706,9 +708,13 @@ Skill: **ipal-nav**.
|
||||
→ `{ href, label, internal, newTab, targetProps, children }[]` (dead links skipped); only this data
|
||||
goes to the client component (MobileNav) — `CMSLink` is a server component.
|
||||
- a11y labels (menu button) — fields in the panel.
|
||||
- A global changed on every page → `afterChange` with `revalidatePath('/', 'layout')`.
|
||||
`buildRevalidateHook` is for collections; the plugin's globals (Site Settings, Cookie Settings,
|
||||
Notifications…) do not refresh ISR by themselves — the change shows after the `revalidate` window.
|
||||
- A global changed on every page → `afterChange: [buildGlobalRevalidateHook({ revalidatePath })]`
|
||||
(it calls `revalidatePath('/', 'layout')`). `buildRevalidateHook` is for collections. The plugin's globals
|
||||
(Site Settings, Site Integrations, Cookie Settings, Notifications) refresh ISR themselves once you pass
|
||||
`ipalKit({ revalidatePath })` (from `next/cache`); without it the change shows after the `revalidate` window.
|
||||
- The plugin's globals: read public (Site Integrations: admin only), write editor+. Change their access, admin
|
||||
or hooks with `ipalKit({ globalOverrides: { notifications: { access: { update: authenticated } } } })` —
|
||||
an object merges key by key (your keys win), a function `(global) => global` takes over. Never copy a plugin global.
|
||||
- Only `[locale]/layout.tsx` fetches globals and passes them as props.
|
||||
|
||||
### 6.9 Client components (`'use client'`)
|
||||
@@ -822,7 +828,7 @@ project → **plugin gap**, not a copy.
|
||||
| Need | Use | Doc |
|
||||
|---|---|---|
|
||||
| Payload, settings, languages (cached per request) | `getCachedPayload`, `getSettings`, `getConfiguredLocales` | content.md |
|
||||
| Catch-all page (route, 308, 404, meta, static params, JSON-LD, blocks) | `createPageRoute(content, { blocks, notFound, permanentRedirect, redirect, blockProps, render })` (`/rsc`) → `{ Page, generateMetadata, generateStaticParams }`; `redirect` turns on under-construction mode (works only in this route — Markdown, MCP, sitemap, llms are not covered by it) | pages.md, construction.md |
|
||||
| Catch-all page (route, 308, 404, meta, static params, JSON-LD, blocks) | `createPageRoute(content, { blocks, notFound, permanentRedirect, redirect, blockProps, render })` (`/rsc`) → `{ Page, generateMetadata, generateStaticParams }`; `redirect` turns on under-construction mode for pages; `lib/content` hides the same pages in Markdown and MCP (`isPathVisible`), the sitemap and llms.txt (`underConstructionSeo`); pass `isPathVisible` to `createSearchRoute` yourself | pages.md, construction.md |
|
||||
| 404 from the panel in every language | `createNotFoundPage(content, { load })` + the server action `renderNotFoundView(content, { blocks, fallback }, locale)` (`/rsc`) | pages.md |
|
||||
| Layout: consent, banner, Turnstile, analytics, site JSON-LD, preconnect | `getSiteShell(locale)` + `<SiteProviders shell>` (`/rsc`) | consent.md |
|
||||
| Your own page / archive | `resolveRoute`, `getEntries`, `resolvePageRedirect`, `generatePageMetadata`, `getPageJsonLd`, `generateStaticParams` | content.md, pages.md |
|
||||
@@ -840,7 +846,9 @@ project → **plugin gap**, not a copy.
|
||||
| Slug / noindex / description for AI | `buildSlugField`, `buildNoindexField`, `buildSummaryField` | slug.md, seo.md |
|
||||
| System pages and their protection | `getSystemPagePath`, `buildPreventDeleteSystemPage`, `buildValidateUniqueRole` | pages.md, hooks.md |
|
||||
| ISR after save, old slug → 308, images across languages | `buildRevalidateHook`, `trackSlugHistoryHook`, `buildCrossLocaleFieldSync` | hooks.md |
|
||||
| Roles and access | `adminOnly`, `adminOrEditor`, `adminOrSelf`, `authenticated`, `requireRole`, `hasMinimumRole` (+ `…Field`) | access.md |
|
||||
| ISR after a global is saved | plugin globals: `ipalKit({ revalidatePath })`; your own globals: `buildGlobalRevalidateHook({ revalidatePath })` | hooks.md |
|
||||
| Change a plugin global (access, hooks, fields) | `ipalKit({ globalOverrides })` | access.md |
|
||||
| Roles and access | `adminOnly`, `adminOrEditor`, `adminOrSelf`, `authenticated`, `requireRole`, `hasMinimumRole` (+ `…Field`); injected `users`: `access.authAccess`, first user = admin (`access.firstUserAdmin`) | access.md |
|
||||
| Data from globals | `getGlobal`, `getSiteSettings`, `getSiteIntegrations` | payload-helpers.md |
|
||||
|
||||
**Links and navigation**
|
||||
@@ -863,7 +871,7 @@ project → **plugin gap**, not a copy.
|
||||
| Sending | `createSubmitAction({ getCachedPayload, headers })` (`/server`) | forms.md |
|
||||
| Message texts and step button texts | Notifications → `getFormTexts(locale)` | notifications.md |
|
||||
| A form in the database | seed `ipal-form/resources/seed-form.template.ts` | forms.md, seeding.md |
|
||||
| Antispam / limit / IP | honeypot in `BuilderForm`, Turnstile from `SiteProviders`, `clientIp`, `setRateLimitStore` | forms.md, turnstile.md |
|
||||
| Antispam / limit / IP | honeypot in `BuilderForm`, Turnstile from `SiteProviders` (`createSubmitAction({ turnstileHostnames })` pins the domain), `clientIp`, `setRateLimitStore`, `setUnknownIpFactor` | forms.md, turnstile.md |
|
||||
| GTM event after sending | `buildFormAnalyticsFields` (panel) — `RenderForm` sends it itself | forms.md |
|
||||
| A form outside the builder (e.g. filters) | `useForm` + `buildValidator`, `required`, `email`… | forms.md |
|
||||
|
||||
@@ -871,12 +879,13 @@ project → **plugin gap**, not a copy.
|
||||
| Need | Use | Doc |
|
||||
|---|---|---|
|
||||
| Metadata, canonical, hreflang, OG, X | `generatePageMetadata` (`createPageRoute` does it itself) | seo.md |
|
||||
| sitemap / robots / manifest | `sitemapRoute`, `robots`, `manifest` | seo.md |
|
||||
| sitemap / robots / manifest | `sitemapRoute` (splits into a sitemap index above 10 000 URLs; `sitemapOptions`, `sitemapEntries`), `getRobots` (panel) / `robots` (code only), `manifest` | seo.md |
|
||||
| Search Console / Bing verification, AI crawler policy, llms.txt note | Site Settings → Search & AI (`seo.searchSettings`); building blocks `verificationFrom`, `robotsOptionsFrom` | seo.md |
|
||||
| JSON-LD | `getSiteShell().jsonLd`, `getPageJsonLd`, `build*JsonLd`, `formatOpeningHours`, `sameAsUrls`, `<JsonLdGraph>` | seo.md |
|
||||
| Product / category JSON-LD (an entry that is not an article) | `pageJsonLd.entries` + `buildProductJsonLd` | seo.md |
|
||||
| llms.txt / llms-full / Markdown / MCP | `llmsRoute`, `llmsFullRoute`, `markdownRoute`, `mcpGET`/`mcpPOST`; `markdownAlternate: true`; `createProxy({ markdown: true })` | seo.md, content.md, mcp.md |
|
||||
| IndexNow | `ipalKit({ indexNow: true })` + `indexNowKeyRoute` | seo.md |
|
||||
| Search | `createSearchRoute` | content.md |
|
||||
| Search | `createSearchRoute({ …, isPathVisible })` | content.md |
|
||||
|
||||
**Media, look, speed**
|
||||
| Need | Use | Doc |
|
||||
@@ -894,7 +903,7 @@ project → **plugin gap**, not a copy.
|
||||
| Settings window: in the bar / small / large with cookie details | `<CookieBanner settings="inline" \| "modal" \| "detailed">` — do not build your own window or cookie list | consent.md → "Large window with details" |
|
||||
| A consent-dependent script | `ConsentScript` | consent.md |
|
||||
| Cookie table on the policy page | `<CookieTable>` (`/rsc`), `getCookieTable` | consent.md |
|
||||
| GA4, GTM, Pixel, Clarity, LinkedIn, TikTok | IDs in the panel — `SiteProviders` loads `Analytics` (`analytics={{ defer: true }}`) | analytics.md |
|
||||
| GA4, GTM, Pixel, Clarity, LinkedIn, TikTok | IDs in the panel — `SiteProviders` loads `Analytics` (`analytics={{ defer: true }}`; `consentMode: 'basic'` = no Google request before consent) | analytics.md |
|
||||
| Mail | `email: mailAdapter()`, `sendEmail` | email.md |
|
||||
| Env validation, health | `assertEnv(ipalEnvRules({…}))` (`/env`), `healthRoute` | env.md |
|
||||
| 2FA, white-label, headers | `twoFactor: { issuer, plugin: payloadTotp }`, `whiteLabel`, `buildSecurityHeaders` | security.md, white-label.md |
|
||||
@@ -910,6 +919,31 @@ requires it (accessibility.md).
|
||||
payloadTotp } })`, never `twoFactor: false` without a client decision). CSP: first
|
||||
`report-only`, then `enforce`; no Trusted Types (they break Turnstile/GA).
|
||||
|
||||
### 7.1 Newer defaults — turn off / override (the plugin helps, never limits)
|
||||
|
||||
| Feature (default) | Turn off | Override / building blocks |
|
||||
|---|---|---|
|
||||
| Plugin globals: write editor+ (Site Integrations: admin) | — | `ipalKit({ globalOverrides: { <slug>: { access, admin, hooks } } })`; a function `(global) => global` takes over (`applyGlobalOverrides`) |
|
||||
| Global saves revalidate the layout (with `ipalKit({ revalidatePath })`) | omit `revalidatePath`; once: `context: { disableRevalidate: true }` | `buildGlobalRevalidateHook` on your own globals |
|
||||
| Injected `users`: admin manages everyone, others only themselves | — | `access.authAccess` (your keys win); your own `users` collection wins whole |
|
||||
| First registered account = admin | `access.firstUserAdmin: false` | `buildRolesField(defaultRole, { firstUserAdmin })` |
|
||||
| 2FA on the panel's login collection, mismatch = startup error | `twoFactor: false` (discouraged) | `twoFactor.collectionSlug`, `allowCollectionMismatch: true` |
|
||||
| `enabled: false` keeps the schema | — | — (no endpoints, `onInit` or admin components; no DROP TABLE in `migrate:create`) |
|
||||
| No client IP = one shared `unknown-ip` bucket at 20× the limit | `setUnknownIpFactor(0)` (only with a limiter in front) | `setUnknownIpFactor(n)`; `UNKNOWN_IP_FACTOR` |
|
||||
| Turnstile token domain not checked | (default) | `createSubmitAction({ turnstileHostnames })`, `verifyTurnstile({ hostnames })` — leave empty in dev |
|
||||
| Consent Mode `advanced` | `consentMode: 'basic'` | your own `<Analytics>` props (`SiteProviders analytics={false}`) |
|
||||
| Locale cookie: consent read under its own stored version | — | `createProxy(config, { policyVersion })` / `createLocaleMiddleware({ policyVersion })` |
|
||||
| Construction mode hides pages in Markdown, MCP | `markdown: { isPathVisible: () => true }`, `mcp: { isPathVisible: () => true }` | `isPathVisible`, `isPathVisibleIn(mode, path)`, `pathOf(url)`, type `PathVisibility` |
|
||||
| Construction mode filters the sitemap and llms.txt | `underConstructionSeo: false` | `include` / `getIncludedPaths` in the low-level builders |
|
||||
| `getSettings` at `depth: 1` | — | `createContentHelpers({ settingsDepth: 2 })` (every request pays) |
|
||||
| `RenderRichText` renders unsafe link URLs as `#` | `safeLinks={false}` (fully trusted content only) | your own `converters` |
|
||||
| Search & AI tab in Site Settings | `seo.searchSettings: false` | `searchSettings: (fields) => fields`; `verificationFrom`, `robotsOptionsFrom` |
|
||||
| Verification `<meta>` from the panel | empty fields = no tag | `const { verification, ...meta } = await generatePageMetadata(…)` |
|
||||
| AI crawler policy from the panel | `robots` instead of `getRobots`; policy `default` | `buildRobots({ ...robotsOptionsFrom(settings), aiBotRules })`; `AI_ASSISTANT_BOTS`, `AI_TRAINING_BOTS` |
|
||||
| Sitemap split / CDN cache / memo | `sitemapOptions: { maxUrls: Infinity, cacheControl: false, memoSeconds: 0 }` | `sitemapEntries`, `createSitemapRouteHandler`, `buildSitemapIndexXml`, `buildSitemapEntries` |
|
||||
| Sitemap error = 503 + `Retry-After` | — (correct HTTP behaviour) | your own route with `buildSitemapXml` |
|
||||
| IndexNow silent with `IPAL_NOINDEX` | `indexNow` off by default | `submitToIndexNow` by hand |
|
||||
|
||||
---
|
||||
|
||||
## 8a. TESTS — what you check and how
|
||||
@@ -987,7 +1021,7 @@ Rules:
|
||||
| a hardcoded domain in a Media hook | another project = someone else's domain | R2 from env via the plugin |
|
||||
| `siteName \|\| 'Firma X'` | someone else's data in another project | omit the field |
|
||||
| a hand-rendered favicon | Google does not show it | `buildIconsMetadata` |
|
||||
| a copied `Analytics` in the project | pixels without consent (GDPR) | `Analytics` from the plugin via `SiteProviders` (options: `analytics={{ defer }}`) |
|
||||
| a copied `Analytics` in the project | pixels without consent (GDPR) | `Analytics` from the plugin via `SiteProviders` (options: `analytics={{ defer, consentMode }}`) |
|
||||
| `import('@payload-config')` through a variable | `Cannot find module` in the build | injection / props |
|
||||
| `ctaLabel`, `buttonUrl`, `pdfUrl` in blocks | a zoo of fields, no consistency | `buildLinksField()` |
|
||||
| no `@source` for the plugin in CSS | plugin components without styles | `@source` |
|
||||
@@ -1153,7 +1187,7 @@ the task matches — manually: `/<name>`.
|
||||
| `ipal-debug` | anything does not work — procedure + a symptom → cause → fix table |
|
||||
| `ipal-audit` | before every "done" — the §0b set + the §11 checks + panel (§6.5a) + hardcoding in JSX + tsc + build |
|
||||
| `ipal-seo-check` | the running site through the eyes of Googlebot and AI agents (head, canonical, hreflang, sitemap, 404, JSON-LD, llms, Markdown, MCP) |
|
||||
| `ipal-consent-check` | browser: no pixels and no tracking cookies before consent |
|
||||
| `ipal-consent-check` | browser: no tracking pixels or cookies before consent; the Google tag may load before consent only in Consent Mode `advanced` (all signals `denied`) — a client who wants zero requests gets `consentMode: 'basic'` |
|
||||
| `ipal-plugin-gap` | ipal-kit has a bug or is missing a feature — report + a marked workaround, the work goes on |
|
||||
|
||||
Run the scripts in the skills, do not read them (the output is enough): `ipal-audit/scripts/audit.sh`,
|
||||
|
||||
@@ -7,6 +7,9 @@ description: Proves in a real browser (Playwright) that an ipal-kit site respect
|
||||
|
||||
GDPR: non-Google tags load **only after consent**; Google (GA4/GTM) may
|
||||
load earlier only with the Consent Mode "denied" signal and without cookies.
|
||||
That early load happens only in Consent Mode `advanced` (the default); with
|
||||
`<SiteProviders analytics={{ consentMode: 'basic' }}>` no request goes to `googletagmanager.com`
|
||||
before analytics or marketing consent — check the project's choice in "Project decisions".
|
||||
|
||||
## Steps
|
||||
1. Once per project:
|
||||
|
||||
@@ -56,7 +56,7 @@ through this procedure. Ask only when you are missing something you cannot get y
|
||||
| empty SEO tab, no Forms | mismatched `@payloadcms/*` versions | all `@payloadcms/*` = the `payload` version |
|
||||
| upload rejected "Image is … Tick Optimize" | `buildOptimizeUploadHook` (intended) | tick the checkbox or prepare the file; limit in the hook options |
|
||||
| video upload rejected | `maxVideoBytes` limit | export as the message says (H.264, 720–1080p, fast start) |
|
||||
| change in the panel not visible | no Save / ISR without revalidation | collection: `buildRevalidateHook`; global (Header, Footer…): your own `afterChange` with `revalidatePath('/', 'layout')` (ipal-nav) — the plugin does not revalidate its own globals (Site Settings, Cookie Settings, Notifications) (ipal-plugin-gap report): the change waits until the `revalidate` window ends; as a stopgap add an `afterChange` to them with your own plugin placed after `ipalKit` in `plugins` (it modifies `config.globals`) |
|
||||
| change in the panel not visible | no Save / ISR without revalidation | collection: `buildRevalidateHook`; your own global (Header, Footer…): `afterChange: [buildGlobalRevalidateHook({ revalidatePath })]` (ipal-nav); the plugin's globals (Site Settings, Site Integrations, Cookie Settings, Notifications): pass `ipalKit({ revalidatePath })` (from `next/cache`) — without it the change waits until the `revalidate` window ends |
|
||||
|
||||
### Front end / routing / SEO
|
||||
| Symptom | Cause | Fix |
|
||||
|
||||
@@ -17,11 +17,11 @@ Requires the UI primitives from `../ipal-block/resources/section-code.md` (like
|
||||
## Code
|
||||
1. `src/globals/Header.ts`, `Footer.ts` — from §6.8; `Company.ts` — company data
|
||||
(localized texts), `access.read: () => true`.
|
||||
2. An `afterChange` hook on every global: `revalidatePath('/', 'layout')`
|
||||
(import from `next/cache`, hooks.md). The plugin's `buildRevalidateHook` is only for
|
||||
collections with a slug — it does not refresh globals. Skip the call outside the Next server
|
||||
(`!process.env.NEXT_RUNTIME` — seed, migration) and when `context.disableRevalidate` is set,
|
||||
otherwise `next/cache` throws "static generation store missing".
|
||||
2. On every global: `hooks: { afterChange: [buildGlobalRevalidateHook({ revalidatePath })] }`
|
||||
(`revalidatePath` from `next/cache`, hooks.md) — it calls `revalidatePath('/', 'layout')` and already
|
||||
skips the call outside the Next server (seed, migration) and with `context.disableRevalidate`.
|
||||
`buildRevalidateHook` is for collections. The plugin's own globals refresh themselves with
|
||||
`ipalKit({ revalidatePath })`.
|
||||
3. Menu: `await resolveNav(header.navItems, locale)` from `lib/content` (plugin) — links
|
||||
resolved on the server to `{ href, label, internal, newTab, targetProps, children }`.
|
||||
Do not create `lib/navigation.ts`.
|
||||
|
||||
@@ -85,18 +85,17 @@ export const Footer: GlobalConfig = {
|
||||
- **Company data** (name, address, NIP/ABN, phone) — the project's `company` global;
|
||||
the footer and JSON-LD read from it. Compute the copyright year in code
|
||||
(`new Date().getFullYear()`), take the name from the global.
|
||||
- **Refreshing:** a global changes on every page → an `afterChange` hook
|
||||
with `revalidatePath('/', 'layout')` (hooks.md; `buildRevalidateHook` does not handle globals):
|
||||
- **Refreshing:** a global changes on every page → `buildGlobalRevalidateHook` in `afterChange`
|
||||
(hooks.md; it calls `revalidatePath('/', 'layout')`, skips seeds/migrations and `context.disableRevalidate`;
|
||||
`buildRevalidateHook` is for collections):
|
||||
|
||||
```ts
|
||||
// src/globals/Header.ts (and Footer, Company)
|
||||
import { buildGlobalRevalidateHook } from '@intecion/ipal-kit'
|
||||
import { revalidatePath } from 'next/cache'
|
||||
|
||||
hooks: {
|
||||
afterChange: [({ context }) => {
|
||||
// outside the Next server (seed, migration) next/cache throws
|
||||
if (process.env.NEXT_RUNTIME && !context.disableRevalidate) revalidatePath('/', 'layout')
|
||||
}],
|
||||
afterChange: [buildGlobalRevalidateHook({ revalidatePath })],
|
||||
},
|
||||
```
|
||||
|
||||
|
||||
@@ -25,11 +25,14 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
|
||||
| `access` | none | `roles` field (`user` < `editor` < `admin`, `saveToJWT`) in the auth collection | omit → **no roles**: nobody is admin for Site Integrations, the e-mail test, stats, consent-records; `form-submissions` readable by editor+ only |
|
||||
| `access.authCollection` | — (required in `access`) | collection that gets `roles`; also the slug of the injected auth collection | your own collection with that slug wins |
|
||||
| `access.defaultRole` | `'user'` | `defaultValue` of the `roles` field | `'editor'` / `'admin'` |
|
||||
| `access.authAccess` | `{ create: adminOnly, delete: adminOnly, read: adminOrSelf, unlock: adminOnly, update: adminOrSelf }` | access of the auth collection the plugin **injects** (Payload's default lets any logged-in account edit or delete every other account) | your keys win, e.g. `{ read: authenticated }`; your own collection with that slug wins whole (give it `adminOrSelf` / `adminOnly` yourself) |
|
||||
| `access.firstUserAdmin` | `true` | the account made on Payload's "Create first user" screen (`/first-register` on an empty collection) gets `roles: ['admin']`; an open sign-up still gets `defaultRole` | `false` = that account gets what was submitted |
|
||||
| `adminRoute` | `'/admin'` | `config.routes.admin`; stats link and views, `IntegrationAlerts` | the project moves `app/(payload)/<route>/` itself and adds the route to the proxy matcher (security.md) |
|
||||
| `twoFactor` | **none = error** | `@clocklimited/payload-2fa` with `forceSetup: true` (TOTP enforced, also checked in the API) | `twoFactor: false` (discouraged); omitting the option throws `[ipal] twoFactor.issuer is required` |
|
||||
| `twoFactor.issuer` | — (required) | name in the authenticator app | — |
|
||||
| `twoFactor.plugin` | — (required) | injected `payloadTotp` (the plugin does not import the peer) | missing function → throws |
|
||||
| `twoFactor.collectionSlug` | `'users'` | collection with 2FA | does **not** take `access.authCollection` — with a different slug, set both |
|
||||
| `twoFactor.collectionSlug` | the panel's login collection (`admin.user`, else the first auth collection) | collection with 2FA; startup fails with `[ipal] twoFactor…` when it is not an auth collection or differs from `admin.user` | point it at the login collection |
|
||||
| `twoFactor.allowCollectionMismatch` | `false` | allows `collectionSlug` ≠ `admin.user` (panel users of the other collection then skip 2FA) | `true` only when you protect a second auth collection on purpose |
|
||||
| `whiteLabel` | none | `admin.components.graphics.Logo/Icon` (`AdminLogo`/`AdminIcon`) from Site Settings + vendor credit | omit / `false`; `true` = defaults |
|
||||
| `whiteLabel.settingsSlug` | `'site-settings'` | global it reads the logo/name from | — |
|
||||
| `whiteLabel.logoField` / `iconField` / `nameField` | `'logo'` / `'favicon'` / `'siteName'` | fields in Site Settings | any upload/text field |
|
||||
@@ -46,6 +49,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
|
||||
| `seo.descriptionCheck` | on (`settingsSlug: 'site-settings'`, `siteDescriptionField: 'siteDescription'`) | UI field `MetaDescriptionCheck` below the description (empty / duplicated) | `false`; object overrides slug/field |
|
||||
| `seo.fields` | `[]` | extra fields in the SEO group | — |
|
||||
| `seo.generateTitle` / `generateDescription` | plugin-seo | preview / generation in the panel | your own function `({ doc }) => string` |
|
||||
| `seo.searchSettings` | on (also without `seo`) | Site Settings → **Search & AI** tab: `searchVerification.google/bing/yandex` (→ `<meta>` via `generatePageMetadata`), `aiCrawlers.policy` + `aiCrawlers.rules[]` (→ robots.txt via `getRobots`), localized `llmsIntro` (→ top of `/llms.txt`); empty fields change nothing. Postgres: `migrate:create` after upgrading | `false` = no tab (without `seo`: `globalOverrides['site-settings']` function); `(fields) => fields` = your own set (keep the names `searchVerification`, `aiCrawlers`, `llmsIntro` or read your own fields in your routes) |
|
||||
| — (no option) | `uploadsCollection: 'media'` | meta image from the `media` collection | currently always `media` (gap) |
|
||||
| `forms` | none | `@payloadcms/plugin-form-builder`: `forms`, `form-submissions` collections | omit |
|
||||
| `forms.adminGroup` | `'Forms'` | sidebar group | `false` = Payload default; `admin.group` in overrides wins |
|
||||
@@ -55,27 +59,30 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
|
||||
| `forms.redirectRelationships` | none | collections a form can redirect to | `['pages']` |
|
||||
| `forms.emailLayout` | `false` | `beforeEmail` with a layout (logo, colour, footer) + Site Settings → **Emails** tab; `{{*:table}}` readable | `true` |
|
||||
| `forms.beforeEmail` | none | your own e-mail changes (after the layout) | form-builder function |
|
||||
| `forms.consentFieldName` | (`'consent'`) | **currently unused by the plugin** — pass the consent field name in `createSubmitAction({ consentFieldName })` / `submitForm` | — |
|
||||
| `forms.consentFieldName` | `'consent'` | name of the GDPR consent field `submitForm` requires (read from `config.custom.ipal`) | `createSubmitAction({ consentFieldName })` / `submitForm` argument wins |
|
||||
| `consentLog` | off | `consent-records` collection + `POST /api/ipal/consent` (rate limit 20/min) | `true` / `{ retentionDays }` (default 1095) |
|
||||
| `stats` | off | `stats-visits` collection, `POST /api/ipal/hit`, `/<admin>/stats` view, nav link, dashboard chart | `true` / object |
|
||||
| `stats.retentionDays` / `timeZone` / `dashboard` | 90 / `'Europe/Warsaw'` / `true` | retention, day boundary, `StatsWidget` | `dashboard: false` hides the chart |
|
||||
| `indexNow` | `false` | `afterChange` hook (publish → IndexNow, production + https only) in the `pages.slug ?? 'pages'` collection and each one from `content` | `true` + `indexnow-key.txt` route |
|
||||
| `siteSettingsFields` | none | **Custom** tab in Site Settings | `Field[]` |
|
||||
| `integrationsFields` | none | **Custom** tab in Site Integrations | `Field[]` |
|
||||
| `enabled` | `true` | `false` → the plugin **returns the config unchanged**: injected collections, globals, endpoints, 2FA and roles disappear (data stays in the database, the panel does not see it); `i18n` is validated anyway | `false` |
|
||||
| `globalOverrides` | none | changes the plugin's globals (`site-settings`, `site-integrations`, `cookie-settings`, `notifications`): an object merges `access` / `admin` / `hooks` key by key (your keys win, your hooks run after the plugin's), other keys replace; a function `(global) => global` takes over | e.g. `{ notifications: { access: { update: authenticated } } }`; the way to change the plugin globals' access or hooks |
|
||||
| `revalidatePath` | none | `revalidatePath` from `next/cache` (injected): saving any plugin global revalidates the whole layout (`buildGlobalRevalidateHook`) | omit = globals change after the ISR window; once: `context: { disableRevalidate: true }` |
|
||||
| `enabled` | `true` | `false` → collections, globals and fields stay (schema and migrations unchanged), but no plugin endpoints (`/api/ipal/*`), no `onInit` work and no admin components; `i18n` is validated anyway | `false`; check: `payload migrate:create` after switching produces no DROP TABLE |
|
||||
|
||||
## 2. What the plugin adds by itself
|
||||
|
||||
| element | what | controlled by | turning off today |
|
||||
|---|---|---|---|
|
||||
| auth collection (`users`) | `{ slug, auth: true, useAsTitle: 'email' }`, when the project has none (slug: `access.authCollection` → `twoFactor.collectionSlug` → `admin.user` → `'users'`) | your own collection with that slug | yours wins |
|
||||
| auth collection (`users`) | `{ slug, auth: true, useAsTitle: 'email' }`, when the project has none (slug: `access.authCollection` → `twoFactor.collectionSlug` → `admin.user` → `'users'`); with `access`: create/delete/unlock admin only, read/update admin or self | `access.authAccess`; your own collection with that slug | yours wins |
|
||||
| `forms`, `form-submissions` | form-builder + ipal blocks `step`, `checkboxGroup`, `time` | `forms` | omit `forms` |
|
||||
| `consent-records` | proof of consent (id, choices, policy version) | `consentLog` | off by default |
|
||||
| `stats-visits` | visits without IP (admin reads/deletes) | `stats` | off by default |
|
||||
| global `site-settings` | General, Theme, [System Pages], [Emails], [Under construction], [Custom]; public read | `pages`, `content`, `forms.emailLayout`, `siteSettingsFields` | **currently always** |
|
||||
| global `site-integrations` | Analytics, Turnstile, SMTP, IndexNow, [Custom]; admin only | `integrationsFields` | **currently always** |
|
||||
| global `cookie-settings` | banner texts, categories, cookie list | — | **currently always** |
|
||||
| global `notifications` | form messages per language | — | **currently always** |
|
||||
| global `site-settings` | General, Theme, [System Pages], [Emails], [Under construction], Search & AI, [Custom]; public read, write editor+ | `pages`, `content`, `forms.emailLayout`, `seo.searchSettings`, `siteSettingsFields` | always present; access/hooks/fields: `globalOverrides` |
|
||||
| global `site-integrations` | Analytics, Turnstile, SMTP, IndexNow, [Custom]; admin only | `integrationsFields` | always present; `globalOverrides` |
|
||||
| global `cookie-settings` | banner texts, categories, cookie list; public read, write editor+ | `globalOverrides` | always present; `globalOverrides` |
|
||||
| global `notifications` | form messages per language; public read, write editor+ | `globalOverrides` | always present; `globalOverrides` |
|
||||
| global revalidation hook | `afterChange` on the four globals → `revalidatePath('/', 'layout')` | `revalidatePath` | omit `revalidatePath` |
|
||||
| `POST /api/ipal/test-email` | SMTP/Graph test (admin only) | — | **currently always** |
|
||||
| `POST /api/ipal/consent` | saves consent | `consentLog` | off by default |
|
||||
| `POST /api/ipal/hit` | page view for stats | `stats` | off by default |
|
||||
@@ -119,15 +126,15 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
|
||||
| theme | layout | `<SiteProviders theme>` (or `<ThemeScript {...shell.theme} />` from `/rsc`), `<html suppressHydrationWarning>`; switcher `<ThemeSwitcher>` (`/client`) | `data-theme` on `<html>` before hydration | theme.md |
|
||||
| catch-all | `app/(frontend)/[locale]/[[...slug]]/page.tsx` | `export const revalidate = 3600`; `const route = createPageRoute(content, { blocks, notFound, permanentRedirect, blockProps })`; `export default route.Page`; `generateMetadata`, `generateStaticParams` | `curl -s $U/pl/<slug>` 200; change the slug → the old one gives 308 | frontend.md, pages.md |
|
||||
| 404 | `[locale]/not-found.tsx` + `notFoundView.ts` | `export default createNotFoundPage(content, { load: loadNotFoundView })`; `'use server'` `renderNotFoundView(content, { blocks }, locale)` | `curl -sI $U/pl/xyz` → 404 with content from System Pages | pages.md |
|
||||
| sitemap | `app/sitemap.xml/route.ts` | `export { sitemapRoute as GET } from '@/lib/content'` + `dynamic = 'force-dynamic'` (or `sitemap.ts` with `sitemap` — never both) | `curl -s $U/sitemap.xml` (hreflang, XSL style) | seo.md |
|
||||
| robots | `app/robots.ts` | `export { robots as default } from '@/lib/content'` | `curl -s $U/robots.txt` (Sitemap:, AI bots) | seo.md |
|
||||
| sitemap | `app/sitemap.xml/route.ts` | `export { sitemapRoute as GET } from '@/lib/content'` + `dynamic = 'force-dynamic'` (or `sitemap.ts` with `sitemap` — never both; only `sitemapRoute` splits a large site into a `<sitemapindex>` with `?part=N` parts above 10 000 URLs) | `curl -s $U/sitemap.xml` (hreflang, XSL style); `curl -sI` → `Cache-Control: public, max-age=0, s-maxage=3600…`; a database error → 503 + `Retry-After` | seo.md |
|
||||
| robots | `app/robots.ts` | `export { getRobots as default } from '@/lib/content'` + `force-dynamic` (AI crawler policy from Site Settings → Search & AI); `robots` (sync) ignores the panel | `curl -s $U/robots.txt` (Sitemap:, AI bots, `User-agent` groups from the panel) | seo.md |
|
||||
| manifest | `app/manifest.ts` | `export { manifest as default }` + `force-dynamic` | `curl -s $U/manifest.webmanifest` | seo.md |
|
||||
| llms | `app/llms.txt/route.ts`, `app/llms-full.txt/route.ts` | `export { llmsRoute as GET }` / `llmsFullRoute` + `force-dynamic` | `curl -s $U/llms.txt` | seo.md |
|
||||
| Markdown | `app/md/[locale]/[[...slug]]/route.ts` | `export { markdownRoute as GET }` + `force-dynamic` | `curl -s $U/md/pl` | content.md |
|
||||
| MCP | `app/api/mcp/route.ts` | `export { mcpGET as GET, mcpPOST as POST }` + `force-dynamic` | `curl -s -X POST $U/api/mcp -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'` | mcp.md |
|
||||
| health | `app/api/health/route.ts` | `export { healthRoute as GET }` + `force-dynamic` | `curl -s $U/api/health` → `"status":"ok"` (503 on a database error) | deployment.md |
|
||||
| IndexNow key | `app/indexnow-key.txt/route.ts` | `export { indexNowKeyRoute as GET }` + `force-dynamic` | `curl -s $U/indexnow-key.txt` = the key | seo.md |
|
||||
| search (optional) | `app/api/search/route.ts` | `export const GET = createSearchRoute({ getCachedPayload, config: i18nConfig, baseUrl })` | `curl -s "$U/api/search?q=test&locale=pl"` | content.md |
|
||||
| search (optional) | `app/api/search/route.ts` | `export const GET = createSearchRoute({ getCachedPayload, config: i18nConfig, baseUrl, isPathVisible })` (`isPathVisible` from `@/lib/content` — hides pages under construction) | `curl -s "$U/api/search?q=test&locale=pl"` | content.md |
|
||||
| Pages | `src/collections/Pages.ts` | `buildSlugField({ from: 'title' })`, `buildNoindexField()`, `buildSummaryField()`, `slugHistory` field + `trackSlugHistoryHook`, `buildRevalidateHook({ revalidatePath, config })` → `afterChange`/`afterDelete` | edit in the panel → the page refreshes without a deploy | slug.md, hooks.md, seo.md |
|
||||
| Pages — protection | as above | `beforeDelete: [buildPreventDeleteSystemPage({ settingsSlug: 'site-settings' })]`; `setPublishedAtHook`, `buildCrossLocaleFieldSync(...)` as needed | delete the homepage → error | hooks.md |
|
||||
| Media | `src/collections/Media.ts` | `upload: { focalPoint: true }`, `hooks.beforeOperation: [normalizeFilenameHook, buildOptimizeUploadHook(), buildMediaPlaceholderHook()]`, fields `buildOptimizeUploadField()`, `buildMediaPlaceholderField()`, `alt` | upload `Zdjęcie Ś.JPG` → `zdjecie-s.jpg`, placeholder in the document | media.md |
|
||||
@@ -140,7 +147,7 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
|
||||
| consent | layout + policy page | banner via `SiteProviders`; table `<CookieTable rows={…} labels={…} />` (`/rsc`) from `getCookieTable` | `ipal-consent-check`; delete the consent cookie → the banner comes back | consent.md |
|
||||
| proof of consent | config + layout | `consentLog: true` + `logEndpoint="/api/ipal/consent"` | after a click, a document in Consent Records | consent.md |
|
||||
| stats | config + layout | `stats: true` + `<SiteProviders stats={{ locale }}>` (or `<PageStats locale />` inside `ConsentProvider`) | `/<admin>/stats`; `POST /api/ipal/hit` request in Network | stats.md |
|
||||
| analytics | layout | `SiteProviders` wires `Analytics` (ID from Site Integrations → Analytics) | GTM/GA loads only after consent | analytics.md, gtm-meta-pixel.md |
|
||||
| analytics | layout | `SiteProviders` wires `Analytics` (ID from Site Integrations → Analytics); Consent Mode: `analytics={{ consentMode: 'basic' }}` = no request to Google before consent, default `'advanced'` = the Google tag loads at once with every signal `denied` | Meta/other pixels only after consent; in `basic` no `gtm.js` / `gtag/js` in Network before consent | analytics.md, gtm-meta-pixel.md |
|
||||
| extra JSON-LD | layout / `lib/content` | `jsonLd={[buildNavigationJsonLd(…)]}`; `siteJsonLd` → `buildLocalBusinessJsonLd` | Rich Results Test | seo.md |
|
||||
| links and navigation | components | `buildLinkField`/`buildLinksField` in fields; `resolveNav`, `resolveLink`, `getSystemLinks` | a menu link still works after a slug change | links.md, skill **ipal-nav** |
|
||||
| blocks | `src/blocks/registry.ts` | `blocks` for `createPageRoute`; fields `buildSectionHeaderField`, `buildSectionSettingsField` | block visible on the page | blocks.md, skill **ipal-block** |
|
||||
@@ -154,7 +161,7 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
|
||||
| key | use |
|
||||
|---|---|
|
||||
| `getCachedPayload` | `await getCachedPayload()` — Local API (actions, routes) |
|
||||
| `getSettings(locale)` | Site Settings (`depth: 2`) |
|
||||
| `getSettings(locale)` | Site Settings (`depth: 1`: relations as documents, theirs as ids; `settingsDepth` option changes it) |
|
||||
| `getConfiguredLocales()` | layout: `notFound()` for an unknown language |
|
||||
| `resolveRoute`, `getEntries`, `getNotFoundPage`, `resolvePageRedirect` | your own page / archive instead of `createPageRoute` |
|
||||
| `generatePageMetadata`, `generateStaticParams`, `getPageJsonLd` | used by `createPageRoute`; call by hand in your own pages |
|
||||
@@ -162,11 +169,12 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
|
||||
| `getFormTexts(locale)` | `blockProps` for forms |
|
||||
| `getLinkOptions`, `getHomeSlug`, `resolveLink`, `resolveNav`, `getSystemLinks` | header, footer, CMSLink |
|
||||
| `getConstructionMode` | under-construction mode (construction.md) |
|
||||
| `sitemap`, `sitemapRoute`, `robots`, `manifest`, `llmsRoute`, `llmsFullRoute`, `markdownRoute`, `mcpGET`, `mcpPOST`, `healthRoute`, `indexNowKeyRoute` | re-exports in `app/` (table above) |
|
||||
| `isPathVisible(path, locale)` | `false` for a page construction mode hides; wired into `markdownRoute` and `mcpPOST` already, pass it to `createSearchRoute` |
|
||||
| `sitemap`, `sitemapRoute`, `robots`, `getRobots`, `manifest`, `llmsRoute`, `llmsFullRoute`, `markdownRoute`, `mcpGET`, `mcpPOST`, `healthRoute`, `indexNowKeyRoute` | re-exports in `app/` (table above) |
|
||||
| `i18n` | the `I18nConfig` passed in |
|
||||
|
||||
`createContentHelpers` options (`baseUrl`, `pagesSlug`, `settingsSlug`, `redirectCollections`, `markdown`,
|
||||
`markdownAlternate`, `mcp`, `pageJsonLd`, `robots`, `siteJsonLd`, `sitemapImages`, `sitemapStyle`, `summaryField`)
|
||||
`markdownAlternate`, `mcp`, `pageJsonLd`, `robots` (incl. `aiBotRules`), `settingsDepth`, `siteJsonLd`, `sitemapEntries`, `sitemapImages`, `sitemapOptions` (`maxUrls`, `cacheControl`, `memoSeconds`), `sitemapStyle`, `summaryField`, `underConstructionSeo`)
|
||||
and what throws without `i18n`: frontend.md. `SiteProviders` props: `shell`, `banner`, `cookieButton`, `analytics`,
|
||||
`cookieMap`, `jsonLd`, `logEndpoint`, `preconnect`, `stats`, `theme` — replace any part or set it to `false`.
|
||||
|
||||
@@ -186,7 +194,8 @@ and what throws without `i18n`: frontend.md. `SiteProviders` props: `shell`, `ba
|
||||
| `NEXT_PUBLIC_TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` | `turnstile: true` (names: `siteKeyVar`/`secretVar`) | fallback for keys from Site Integrations → Turnstile; neither set → Turnstile off | panel (takes precedence) or env |
|
||||
| `INDEXNOW_KEY` | no | key from Site Integrations → IndexNow (generated) | env or panel |
|
||||
| `IPAL_IP_HEADER` | `ipHeader: true` + production | rate limit trusts any IP header (spoofing) + warning in prod | env: `cf-connecting-ip` (Cloudflare) / `x-forwarded-for` (Traefik/nginx) |
|
||||
| `IPAL_NOINDEX` | no; `1`/`true`/`yes` **staging/preview only** | — (when set: robots Disallow, meta noindex, `X-Robots-Tag`) | staging env |
|
||||
| `IPAL_NOINDEX` | no; `1`/`true`/`yes` **staging/preview only** | — (when set: robots Disallow, meta noindex, `X-Robots-Tag`, IndexNow sends nothing) | staging env |
|
||||
| `NEXT_PHASE` | set by Next | only tells `next build` from runtime: during the build an unreachable database gives an empty sitemap; at runtime the sitemap throws (route → 503) | do not set by hand |
|
||||
| `NEXT_RUNTIME` | set by Next | `instrumentation.ts` checks for `nodejs`; missing (scripts, seed) → `buildRevalidateHook` does not revalidate | do not set by hand |
|
||||
|
||||
Details: env.md, deployment.md, PROGRAMISTA §3.
|
||||
|
||||
@@ -12,7 +12,7 @@ project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/d
|
||||
|---|---|---|
|
||||
| `ipalKit(options)` | `@intecion/ipal-kit` | Payload 3 plugin (`plugins: [ipalKit({...})]`) — the only wiring point: adds globals (SiteSettings, SiteIntegrations, CookieSettings, Notifications), roles, enforced 2FA, SEO, forms, i18n (localization), white-label, stats, consent log, `/api/ipal/*` endpoints; no auth collection → injects a simple `users`. Validates `i18n` right away (fail fast). `enabled: false` = schema stays, behaviour off. |
|
||||
|
||||
**Types:** `IpalOptions` — `ipalKit()` options: `i18n`, `access`, `twoFactor` (`{ issuer, plugin: payloadTotp }` or `false`), `whiteLabel`, `adminRoute`, `consentLog`, `content`, `forms`, `pages`, `seo`, `stats`, `indexNow`, `siteSettingsFields`, `integrationsFields`, `enabled`.
|
||||
**Types:** `IpalOptions` — `ipalKit()` options: `i18n`, `access`, `twoFactor` (`{ issuer, plugin: payloadTotp }` or `false`), `whiteLabel`, `adminRoute`, `consentLog`, `content`, `forms`, `pages`, `seo`, `stats`, `indexNow`, `siteSettingsFields`, `integrationsFields`, `globalOverrides`, `revalidatePath`, `enabled`. `GlobalOverride`, `GlobalOverrides`, `IpalGlobalSlug` — see Payload globals below.
|
||||
|
||||
## Admin (import map) (`admin`, `branding`, `admin-ui`, `globals/SiteIntegrations`) — details: `node_modules/@intecion/ipal-kit/docs/white-label.md`, `…/docs/integrations.md`, `…/docs/email.md`, `…/docs/links.md`
|
||||
|
||||
@@ -51,8 +51,10 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
|
||||
| `isAdmin(user)` | `@intecion/ipal-kit` | Predicate → `boolean`: `admin` role. |
|
||||
| `isEditor(user)` | `@intecion/ipal-kit` | Predicate → `boolean`: `editor` or higher. |
|
||||
| `ROLE_HIERARCHY` | `@intecion/ipal-kit` | Constant `['user', 'editor', 'admin']` (lowest first) — a higher role meets the requirements of a lower one. The plugin injects the `roles` field into the auth collection (`access.authCollection`). |
|
||||
| `buildRolesField(defaultRole?, { firstUserAdmin? })` | `@intecion/ipal-kit` | The `roles` select field the plugin injects (only admins set roles; `firstUserAdmin` default `true` = the account made on "Create first user" gets `admin`). The plugin wires it itself — use it only for an auth collection the plugin does not manage. |
|
||||
| `injectRoles(config, accessOption)` | `@intecion/ipal-kit` | Adds `roles` to `accessOption.authCollection` in a config. The plugin calls it itself with `access` — do not call. |
|
||||
|
||||
**Types:** `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`).
|
||||
**Types:** `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`).
|
||||
|
||||
## Accessibility — widget (`accessibility`) — details: `node_modules/@intecion/ipal-kit/docs/accessibility.md`
|
||||
|
||||
@@ -74,7 +76,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
|
||||
| Export | Import from | What it does / when |
|
||||
|---|---|---|
|
||||
| `getAnalyticsConfig(payload)` | `@intecion/ipal-kit` | Server: reads public tag IDs (GA4, GTM, Meta Pixel, Clarity, LinkedIn, TikTok) from SiteIntegrations, validates the format → `Promise<AnalyticsConfig>`; pass the result to `<Analytics>`. |
|
||||
| `Analytics` | `@intecion/ipal-kit/client` | Loads all configured tags respecting consent: Google through Consent Mode, the rest only after consent for the category (marketing / analytics). Props = `AnalyticsConfig` + `defer`, `deferTimeoutMs`. Renders nothing; mount once inside `ConsentProvider`. Do not add tags by hand. |
|
||||
| `Analytics` | `@intecion/ipal-kit/client` | Loads all configured tags respecting consent: Google through Consent Mode, the rest only after consent for the category (marketing / analytics). Props = `AnalyticsConfig` + `defer`, `deferTimeoutMs`, `consentMode` (`'advanced'` default: the Google tag loads at once with every signal `denied`; `'basic'`: no request to Google before analytics or marketing consent). Renders nothing; mount once inside `ConsentProvider`. Do not add tags by hand. |
|
||||
| `pushDataLayer(event, params?)` | `@intecion/ipal-kit/client` | Pushes an event to the GTM `window.dataLayer` (SSR-safe, buffers before GTM loads). E.g. `form_submit` after a form is sent (`docs/gtm-meta-pixel.md`). |
|
||||
| `loadMetaPixel(id)` | `@intecion/ipal-kit/client` | Low-level Meta Pixel loader (idempotent, PageView). `Analytics` calls it itself after marketing consent — call by hand only in unusual cases, and only after consent. |
|
||||
| `loadClarity(id)` | `@intecion/ipal-kit/client` | Microsoft Clarity loader (analytics category). `Analytics` calls it itself — usually do not call. |
|
||||
@@ -130,10 +132,12 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
|
||||
|---|---|---|
|
||||
| `ConstructionNotice` | `@intecion/ipal-kit/client` | "Under construction" popup: `{ mode, classNames? }` — opens after a redirect from a blocked address (`?notice=construction`) and on a click on a link to an unavailable page; texts from the panel, renders nothing when the mode is off. In `[locale]/layout.tsx` with `mode={await getConstructionMode(locale)}`. |
|
||||
| `isPathAllowed(pathname, allowedPaths)` | `@intecion/ipal-kit` | Whether the path is allowed in under-construction mode (exact match, no trailing `/`) → `boolean`. `createPageRoute` uses it itself — by hand only in your own routes. |
|
||||
| `isPathVisibleIn(mode, pathname)` | `@intecion/ipal-kit` | `true` when the mode is off or the path is allowed — the rule behind `isPathVisible` from `createContentHelpers`. For your own routes when you already hold the `ConstructionMode`. |
|
||||
| `pathOf(url)` | `@intecion/ipal-kit` | Pathname of an absolute or relative URL — feed a result URL to a `PathVisibility` check. |
|
||||
| `constructionNoticeHref(homePath)` | `@intecion/ipal-kit` | Redirect address for a blocked page: `${homePath}?notice=construction`. `createPageRoute` uses it itself. |
|
||||
| `CONSTRUCTION_NOTICE_PARAM` | `@intecion/ipal-kit` | Name of the query parameter that opens the popup: `'notice'` (value `construction`). |
|
||||
|
||||
**Types:** `ConstructionMode` (root and `/client`) — `{ enabled, allowedPaths, homePath, texts }` from `getConstructionMode(locale)`; `ConstructionNoticeClassNames` (`/client`) — popup classes.
|
||||
**Types:** `ConstructionMode` (root and `/client`) — `{ enabled, allowedPaths, homePath, texts }` from `getConstructionMode(locale)`; `PathVisibility` — `(path, locale) => boolean | Promise<boolean>` (`isPathVisible` from `createContentHelpers`; the `isPathVisible` option of the Markdown, MCP and search routes); `ConstructionNoticeClassNames` (`/client`) — popup classes.
|
||||
|
||||
## Content and routing (`content`) — details: `node_modules/@intecion/ipal-kit/docs/content.md`
|
||||
|
||||
@@ -156,7 +160,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
|
||||
| `prefersMarkdown(request \| headers \| accept)` | `@intecion/ipal-kit` | whether the `Accept` header prefers `text/markdown` (q-values); for your own proxy — `createProxy({ markdown: true })` does it itself |
|
||||
| `searchContent({ payload, query, config, locale?, limit?, baseUrl?, collection?, summaryField? })` | `@intecion/ipal-kit` | searches published, indexable pages by title/description → `SearchResult[]`; does not throw |
|
||||
| `listContent({ payload, config, locale?, limit? })` | `@intecion/ipal-kit` | list of published, indexable pages (no query) — used by MCP `list_pages` |
|
||||
| `createSearchRoute({ getCachedPayload, config, baseUrl, defaultLimit?, rateLimit?, clientIp? })` | `@intecion/ipal-kit` | `GET` handler for the JSON search endpoint (`?q=&locale=&limit=`), with a per-IP rate limit |
|
||||
| `createSearchRoute({ getCachedPayload, config, baseUrl, defaultLimit?, rateLimit?, clientIp?, isPathVisible? })` | `@intecion/ipal-kit` | `GET` handler for the JSON search endpoint (`?q=&locale=&limit=`), with a per-IP rate limit; pass `isPathVisible` from `@/lib/content` so construction mode hides pages here too |
|
||||
|
||||
**Types:** `ContentOption`, `ContentCollectionOption` — the plugin's `content` option (archive collections: `slug`, `label`, `perPage`); `ResolvedRoute` — `resolveRoute` result; `ArchiveEntries` — a page of entries (`docs`, `page`, `totalDocs`, `totalPages`, `hasPrevPage`, `hasNextPage`); `SearchResult` — search result (`title`, `url`, `description?`, `slug`).
|
||||
|
||||
@@ -184,7 +188,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
|
||||
|
||||
| Export | Import from | What it does / when |
|
||||
|---|---|---|
|
||||
| `createContentHelpers({ config, content?, i18n?, baseUrl?, … })` | `@intecion/ipal-kit` | factory for `src/lib/content.ts`: cached `getCachedPayload`, `getSettings`, `resolveRoute`, `getEntries`, `generatePageMetadata`, `getSiteShell`, `sitemap`, `robots`, `markdownRoute`, `healthRoute`, `mcpGET`/`mcpPOST`… — do not write these wrappers yourself |
|
||||
| `createContentHelpers({ config, content?, i18n?, baseUrl?, … })` | `@intecion/ipal-kit` | factory for `src/lib/content.ts`: cached `getCachedPayload`, `getSettings`, `resolveRoute`, `getEntries`, `generatePageMetadata`, `getSiteShell`, `sitemap`, `robots`, `getRobots`, `isPathVisible`, `markdownRoute`, `healthRoute`, `mcpGET`/`mcpPOST`… — do not write these wrappers yourself |
|
||||
| `createPageRoute(content, { blocks, notFound, permanentRedirect, redirect?, … })` | `@intecion/ipal-kit/rsc` | ready `[[...slug]]` catch-all page → `{ Page, generateMetadata, generateStaticParams }` (blocks, slug history redirects, JSON-LD, under-construction mode); does not paginate `?page=` |
|
||||
| `createNotFoundPage(content, { load } \| { blocks, fallback?, … })` | `@intecion/ipal-kit/rsc` | default export of `not-found.tsx` — the 404 page chosen in the panel or a fallback (the lazy `load` variant is recommended) |
|
||||
| `renderNotFoundView(content, { blocks, fallback?, blockProps?, layoutField? }, locale)` | `@intecion/ipal-kit/rsc` | 404 content in one language — called from a server action for the lazy `createNotFoundPage({ load })` (pages.md) |
|
||||
@@ -205,6 +209,7 @@ Full option lists of `createContentHelpers` / `createPageRoute` / `SiteProviders
|
||||
| Export | Import from | What it does / when |
|
||||
|---|---|---|
|
||||
| `buildRevalidateHook({ revalidatePath, config, homeSlug? })` | `@intecion/ipal-kit` | → `{ afterChange, afterDelete }` that revalidate ISR for the document paths in all languages; the project injects `revalidatePath` from `next/cache` |
|
||||
| `buildGlobalRevalidateHook({ revalidatePath })` | `@intecion/ipal-kit` | Global `afterChange`: `revalidatePath('/', 'layout')` — the whole site picks up the change. The plugin adds it to its own globals when you pass `ipalKit({ revalidatePath })`; wire it yourself on your own globals (Header, Footer). Skip once: `context: { disableRevalidate: true }`. |
|
||||
| `setPublishedAtHook` | `@intecion/ipal-kit` | `beforeChange`: sets `publishedAt` on first publish (does not overwrite an existing date) |
|
||||
| `trackSlugHistoryHook` | `@intecion/ipal-kit` | `beforeChange`: appends the old slug to the `slugHistory` field (add the field yourself); `resolveRedirect` reads it |
|
||||
| `buildPreventDeleteSystemPage({ settingsSlug?, roleFields? })` | `@intecion/ipal-kit` | `beforeDelete`: blocks deleting a page assigned to a system role (homepage, policies) |
|
||||
@@ -226,8 +231,8 @@ Full option lists of `createContentHelpers` / `createPageRoute` / `SiteProviders
|
||||
| `negotiateLocale({ config, cookieLocale, acceptLanguage })` | `@intecion/ipal-kit` | language choice: cookie → Accept-Language → default |
|
||||
| `matchAcceptLanguage(header, config)` | `@intecion/ipal-kit` | matches the `Accept-Language` header to the configured languages |
|
||||
| `LOCALE_COOKIE_NAME` | `@intecion/ipal-kit` | constant `'NEXT_LOCALE'` — cookie with the chosen language (functional, saved only with consent) |
|
||||
| `createProxy(i18nConfig, { NextResponse, markdown?, exposeHeaders?, consentCategory?, cookieName? })` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | recommended `proxy.ts`: language negotiation, redirect `/` → `/{locale}`, cookie with consent, `x-locale`/`x-pathname` headers, optional Markdown routes |
|
||||
| `createLocaleMiddleware({ config, cookieName? })` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | lower level: a `req → LocaleMiddlewareResult` function for your own proxy |
|
||||
| `createProxy(i18nConfig, { NextResponse, markdown?, exposeHeaders?, consentCategory?, cookieName?, policyVersion? })` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | recommended `proxy.ts`: language negotiation, redirect `/` → `/{locale}`, cookie with consent, `x-locale`/`x-pathname` headers, optional Markdown routes |
|
||||
| `createLocaleMiddleware({ config, cookieName?, policyVersion? })` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | lower level: a `req → LocaleMiddlewareResult` function for your own proxy. The locale cookie is saved only with `functional` consent (`consentCategory: 'necessary'` = always), read under the version the consent was stored with; `policyVersion` pins one version |
|
||||
| `DEFAULT_PROXY_MATCHER` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | alias of `DEFAULT_MIDDLEWARE_MATCHER` for `createProxy`; paste the value into `config.matcher` as a literal |
|
||||
| `DEFAULT_MIDDLEWARE_MATCHER` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | array `['/((?!api\|admin\|_next\|.*\\..*).*)']` (excludes `api`, `admin`, `_next`, files); paste into `config.matcher` as a literal — Next reads the matcher statically |
|
||||
| `AlternateLinksProvider` | `@intecion/ipal-kit/client` | layout provider that holds the current page's addresses per language (for `LanguageSwitcher`); `SiteProviders` does not mount it |
|
||||
@@ -293,7 +298,7 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
|
||||
| Export | Import from | What it does / when |
|
||||
|---|---|---|
|
||||
| `createSubmitAction({ getCachedPayload, headers, … })` | `@intecion/ipal-kit/server` | Creates the server action `sendForm(formId, locale, values, token?)`: honeypot → `clientIp` → `submitForm` → text from Notifications; returns `SubmitActionResult`. Standard: `export const sendForm = createSubmitAction({ getCachedPayload, headers })` in `actions.ts` |
|
||||
| `submitForm({ payload, formId, data, turnstileToken?, ip?, locale?, maxPerMinute?, consentFieldName? })` | `@intecion/ipal-kit/server` | Server core: rate limit → Turnstile → validation against the panel definition (+ GDPR consent) → saves the submission; returns a `SubmitFormResult` code, not text. Usually through `createSubmitAction`; server-only |
|
||||
| `submitForm({ payload, formId, data, turnstileToken?, ip?, locale?, maxPerMinute?, consentFieldName?, turnstileHostnames? })` | `@intecion/ipal-kit/server` | Server core (`consentFieldName`: argument → `ipalKit({ forms: { consentFieldName } })` → `'consent'`; `turnstileHostnames` rejects a token solved on another domain): rate limit → Turnstile → validation against the panel definition (+ GDPR consent) → saves the submission; returns a `SubmitFormResult` code, not text. Usually through `createSubmitAction`; server-only |
|
||||
|
||||
### Honeypot
|
||||
|
||||
@@ -394,14 +399,15 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
|
||||
| `getGlobal<T>(payload, slug, { locale?, depth? })` | `@intecion/ipal-kit` | Thin `payload.findGlobal` wrapper for any global (the project's too) |
|
||||
| `SITE_SETTINGS_SLUG` | `@intecion/ipal-kit` | Constant: global slug `'site-settings'` |
|
||||
| `SITE_INTEGRATIONS_SLUG` | `@intecion/ipal-kit` | Constant: global slug `'site-integrations'` |
|
||||
| `applyGlobalOverrides(globals, overrides)` | `@intecion/ipal-kit` | Applies `ipalKit({ globalOverrides })` to the plugin's globals: an object merges `access` / `admin` / `hooks` key by key (your keys win, your hooks run after the plugin's), other keys replace; a function `(global) => global` takes over. The plugin calls it itself — pass `globalOverrides`, do not call. |
|
||||
|
||||
**Types:** `GlobalQueryOptions` — `{ locale?, depth? }` of the global helpers.
|
||||
**Types:** `GlobalQueryOptions` — `{ locale?, depth? }` of the global helpers; `IpalGlobalSlug` (`'site-settings' \| 'site-integrations' \| 'cookie-settings' \| 'notifications'`), `GlobalOverride` (object or function), `GlobalOverrides` (map slug → override) — the `globalOverrides` option.
|
||||
|
||||
## Rich text (`richtext`) — details: `node_modules/@intecion/ipal-kit/docs/richtext.md`
|
||||
|
||||
| Export | Import from | What it does / when |
|
||||
|---|---|---|
|
||||
| `RenderRichText({ data, converters?, className?, headingIds? })` | `@intecion/ipal-kit/rsc` | Renders a richText (Lexical) field through Payload's official converter; your own classes via `converters`, `headingIds` adds anchors to headings (the same ids as `extractHeadings`). Instead of a hand-written renderer. |
|
||||
| `RenderRichText({ data, converters?, className?, headingIds?, safeLinks? })` | `@intecion/ipal-kit/rsc` | Renders a richText (Lexical) field through Payload's official converter; your own classes via `converters`, `headingIds` adds anchors to headings (the same ids as `extractHeadings`). Unsafe link URLs (`javascript:`, `data:`…) render as `#`; `safeLinks={false}` turns that off (fully trusted content only). Instead of a hand-written renderer. |
|
||||
| `extractHeadings(data, { levels? })` | `@intecion/ipal-kit`, `@intecion/ipal-kit/rsc` | List of headings `{ id, level, text }` (h2 by default) for a table of contents — ids match `RenderRichText headingIds`. |
|
||||
| `headingText(node)` | `@intecion/ipal-kit` | Plain text of a Lexical node (a heading with bold, links…). |
|
||||
| `buildTableOfContentsField({ name? })` | `@intecion/ipal-kit` | `tableOfContents` group field (show + localized label) for a text block/section — table of contents toggle in the panel. |
|
||||
@@ -436,6 +442,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
|
||||
| `slugsAcrossLocales({ payload, collection, id, config })` | `@intecion/ipal-kit` | Document slug in all languages (separate query, depth 0) — input for hreflang. |
|
||||
| `readSiteMetaConfig({ payload, locale, pagesSlug?, settingsSlug?, settings? })` | `@intecion/ipal-kit` | Reads from SiteSettings: site name, separator (with padding), title order, homepage slug per language, default description and OG image. |
|
||||
| `buildIconsMetadata(favicon)` | `@intecion/ipal-kit` | `icons` (favicon, apple-touch-icon) from the favicon upload in the panel — once in the root layout `generateMetadata`. |
|
||||
| `verificationFrom(settings)` | `@intecion/ipal-kit` | Site Settings → Search & AI verification codes → Next `Metadata.verification` (`google`, `yandex`, `other['msvalidate.01']` for Bing); `undefined` when every field is empty. `generatePageMetadata` adds it itself — by hand only in your own metadata. |
|
||||
| `createManifestHandler({ getCachedPayload, config, settingsSlug? })` | `@intecion/ipal-kit` | `app/manifest.ts` handler from SiteSettings; without a database at build time it returns a minimal manifest. Usually `manifest` from `createContentHelpers`. |
|
||||
| `NoSnippet({ as?, children })` | `@intecion/ipal-kit/client`, `@intecion/ipal-kit/rsc` | Wrapper with `data-nosnippet` — keeps repeated text (footer: address, hours, phone) out of Google snippets. Do not wrap `<main>`. |
|
||||
|
||||
@@ -465,6 +472,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
|
||||
|---|---|---|
|
||||
| `buildSitemapEntries({ payload, config, baseUrl, content? })` | `@intecion/ipal-kit` | All public URLs (pages + archives) with hreflang and lastmod; skips drafts and noindex. Usually `sitemap` from `createContentHelpers`. |
|
||||
| `buildSitemapXml(entries, { cssUrl? })` | `@intecion/ipal-kit` | Serializes entries to XML (optionally with `xml-stylesheet`). |
|
||||
| `buildSitemapIndexXml(items, { cssUrl? })` | `@intecion/ipal-kit` | `<sitemapindex>` for `[{ url, lastModified? }]` — what `sitemapRoute` serves above `maxUrls`. Only for your own sitemap route. |
|
||||
| `createSitemapRouteHandler(sitemap, { style?, cssUrl? })` | `@intecion/ipal-kit` | `GET /sitemap.xml` handler (XML + built-in CSS under `?style`). Usually `sitemapRoute` from `createContentHelpers`; do not keep `app/sitemap.ts` next to it. |
|
||||
| `buildSitemapCss({ title?, credit?, accent? })` | `@intecion/ipal-kit` | CSS for how the sitemap looks in a browser (served by the handler). |
|
||||
| `SITEMAP_STYLE_PARAM` | `@intecion/ipal-kit` | `'style'` — sitemap URL parameter that returns CSS instead of XML. |
|
||||
@@ -472,6 +480,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
|
||||
| `buildRobots({ baseUrl, aiBots?, disallowParams?, extraDisallow?, … })` | `@intecion/ipal-kit` | `app/robots.ts` rules: blocks admin/API, points to the sitemap, explicitly allows AI bots (`aiBots: 'allow' \| 'block-training' \| 'disallow'`); with `IPAL_NOINDEX` blocks everything. Usually `robots` from `createContentHelpers`. |
|
||||
| `AI_ASSISTANT_BOTS` | `@intecion/ipal-kit` | List of user agents of AI assistant/search bots (ClaudeBot, PerplexityBot…). |
|
||||
| `AI_TRAINING_BOTS` | `@intecion/ipal-kit` | List of user agents of model-training crawlers (GPTBot, Google-Extended…). |
|
||||
| `robotsOptionsFrom(settings)` | `@intecion/ipal-kit` | Site Settings → Search & AI → AI crawlers as `buildRobots` options (`aiBots` unless the policy is `default`, `aiBotRules`; invalid user agents dropped). `getRobots` from `createContentHelpers` uses it — own robots: `buildRobots({ ...robotsOptionsFrom(settings), … })`. |
|
||||
| `buildLlmsTxt({ payload, config, baseUrl, full?, content?, summaryField?, … })` | `@intecion/ipal-kit` | `/llms.txt` content (or `llms-full.txt` with `full`) from the panel, same rules as the sitemap. |
|
||||
| `createLlmsTxtRoute({ getCachedPayload, config, baseUrl, full?, … })` | `@intecion/ipal-kit` | Ready `GET` handler for `/llms.txt` / `/llms-full.txt`. Usually `llmsRoute` / `llmsFullRoute` from `createContentHelpers`. |
|
||||
| `collectSiteIndex({ payload, config, baseUrl?, content?, locales?, … })` | `@intecion/ipal-kit` | Shared index of public documents per language (URL, title, description, dates) — the source for llms.txt, MCP `list_pages`, IndexNow. Use it before you write your own site listing. |
|
||||
@@ -499,7 +508,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
|
||||
| `validateFaviconField` | `@intecion/ipal-kit` | `FieldHook` that warns when the favicon is < 48×48 or not square. The plugin wires it itself on the favicon field in SiteSettings — call it only for your own favicon field. |
|
||||
| `MetaDescriptionCheck` | `@intecion/ipal-kit/admin` | Hint below the meta description in the SEO tab (description duplicated from the global or another document). Injected by the plugin; after turning the option on, `pnpm generate:importmap`. |
|
||||
|
||||
**Types:** `PageMetadata`, `OgImage` — `buildMetadata` result and OG image; `SeoMeta`, `SeoOption`, `AutoFillMapping` — the `meta` group, the plugin's `seo` option and the auto-fill mapping; `SiteMetaConfig` — `readSiteMetaConfig` result; `RobotsOptions`, `RobotsRules` — `buildRobots` options and result; `SitemapEntry`, `SitemapRouteOptions`, `SitemapStyleOptions` — sitemap entry, handler and style options; `CollectSiteIndexArgs`, `SiteIndexEntry` — `collectSiteIndex` arguments and entry; `NoSnippetProps` (`/client`, `/rsc`) — `NoSnippet` props.
|
||||
**Types:** `PageMetadata`, `OgImage` — `buildMetadata` result and OG image; `SeoMeta`, `SeoOption`, `AutoFillMapping` — the `meta` group, the plugin's `seo` option and the auto-fill mapping; `SiteMetaConfig` — `readSiteMetaConfig` result; `RobotsOptions`, `RobotsRules` — `buildRobots` options and result; `AiBotsPolicy` (`'allow' \| 'block-training' \| 'disallow' \| false`), `AiBotRule` (`{ userAgent, access: 'allow' \| 'disallow' }`, `aiBotRules`, wins over the policy); `VerificationMetadata` — `verificationFrom` result; `SitemapEntry`, `SitemapRouteOptions`, `SitemapStyleOptions` — sitemap entry, handler and style options; `CollectSiteIndexArgs`, `SiteIndexEntry` — `collectSiteIndex` arguments and entry; `NoSnippetProps` (`/client`, `/rsc`) — `NoSnippet` props.
|
||||
|
||||
## Rate limit and client IP (`shared`) — details: `node_modules/@intecion/ipal-kit/docs/forms.md`
|
||||
|
||||
@@ -507,6 +516,8 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
|
||||
|---|---|---|
|
||||
| `clientIp(source, { header?, trustedProxies? })` | `@intecion/ipal-kit` | Client IP from a `Request` or `Headers` (`clientIp(await headers())` in a server action): `cf-connecting-ip`, `x-real-ip`, then XFF counted from the right; `''` when missing. In production pin `header` (or env `IPAL_IP_HEADER`). |
|
||||
| `setRateLimitStore(store \| null)` | `@intecion/ipal-kit` | Shared store (e.g. Redis) for all plugin limiters (forms, consents, MCP…); `null` = process memory. Call once at startup when several instances run. |
|
||||
| `setUnknownIpFactor(n)` | `@intecion/ipal-kit` | Requests with no client IP share one `unknown-ip` bucket with `n` × the limit (every plugin limiter). Call once at startup; `0` = unlimited (only with a limiter in front, e.g. Cloudflare). |
|
||||
| `UNKNOWN_IP_FACTOR` | `@intecion/ipal-kit` | `20` — the default factor of the no-IP bucket. |
|
||||
|
||||
**Types:** `ClientIpOptions` — `clientIp` options; `RateLimitStore` — store contract (`hit(id, cost, windowMs)` → `{ count, resetAt }`).
|
||||
|
||||
@@ -569,7 +580,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
|
||||
| `useTurnstile()` | `@intecion/ipal-kit/client` | In a form: `{ token, TurnstileWidget, reset, … }`; pass the token to `submitForm`. Requires the provider. |
|
||||
| `useOptionalTurnstile()` | `@intecion/ipal-kit/client` | Like `useTurnstile`, but without a provider it returns `enabled: false` instead of throwing — for shared components. |
|
||||
| `Turnstile({ siteKey, onToken, theme? })` | `@intecion/ipal-kit/client` | Raw widget with an explicit key — when you do not use the provider. |
|
||||
| `verifyTurnstile({ token, payload, ip?, onConfigError? })` | `@intecion/ipal-kit/server` | Server-side token verification → `boolean` (`degraded` lets it through by default). `submitForm` does this itself — call it only in your own actions. |
|
||||
| `verifyTurnstile({ token, payload, ip?, onConfigError?, hostnames? })` | `@intecion/ipal-kit/server` | Server-side token verification → `boolean` (`degraded` lets it through by default; `hostnames` = token must be solved on one of them, unset = not checked). `submitForm` does this itself — call it only in your own actions. |
|
||||
| `checkTurnstile({ token, payload, ip? })` | `@intecion/ipal-kit/server` | As above, but returns `{ outcome: 'pass' \| 'reject' \| 'degraded', code? }` and updates the integration status in the panel. |
|
||||
|
||||
**Types:** `TurnstileConfig` (root) — `getTurnstileConfig` result; `TurnstileCheck`, `TurnstileOutcome` (`/server`) — verification result; `TurnstileProps`, `TurnstileTheme` (`/client`) — widget props and theme.
|
||||
|
||||
@@ -1,43 +1,50 @@
|
||||
---
|
||||
name: ipal-seo-check
|
||||
description: Checks a running ipal-kit site the way Googlebot and AI agents see it — metadata inside <head> (not streamed to body), title, description, self canonical, hreflang with x-default, noindex pages leaking into the sitemap, error pages in the sitemap, robots.txt, soft 404s, favicon, JSON-LD, and GEO (llms.txt, llms-full.txt, Markdown version, text/markdown alternate, MCP server, AI bots in robots, health). Use after building pages, before handing over, after deploys, after an ipal-kit upgrade, and whenever SEO, indexing, Search Console or "Google doesn't see" problems come up.
|
||||
description: Checks a running ipal-kit site the way Googlebot and AI agents see it — metadata inside <head> (not streamed to body), title, description, self canonical, hreflang with x-default, noindex pages leaking into the sitemap, error pages in the sitemap, sitemap index parts, Search Console / Bing verification tags, robots.txt, soft 404s, favicon, JSON-LD, and GEO (llms.txt, llms-full.txt, Markdown version, text/markdown alternate, MCP server, AI bots in robots, health). Use after building pages, before handing over, after deploys, after an ipal-kit upgrade, and whenever SEO, indexing, Search Console or "Google doesn't see" problems come up.
|
||||
---
|
||||
|
||||
# ipal-seo-check
|
||||
|
||||
Sprawdza **działającą** aplikację, nie kod — dokładnie to, co dostaje Googlebot.
|
||||
Checks the **running** app, not the code — exactly what Googlebot gets.
|
||||
|
||||
## Kroki
|
||||
1. Uruchom wersję produkcyjną (dev streamuje inaczej niż build):
|
||||
## Steps
|
||||
1. Run the production build (dev streams differently than a build):
|
||||
```bash
|
||||
pnpm build && pnpm start # w drugim terminalu / w tle
|
||||
pnpm build && pnpm start # in a second terminal / in the background
|
||||
node .agents/skills/ipal-seo-check/scripts/seo-check.mjs http://localhost:3000
|
||||
```
|
||||
Produkcja: `node …/seo-check.mjs https://domena.pl --max 40`.
|
||||
`--max N` = ile stron z sitemapy sprawdzić (równo z każdego języka). Nie czytaj
|
||||
źródła skryptu — wynik wystarczy.
|
||||
2. Pokaż pełny wynik. Każde `[ERROR]` napraw — przy każdym jest wskazówka i
|
||||
sekcja dokumentacji. Typowe przyczyny:
|
||||
Production: `node …/seo-check.mjs https://domain.com --max 40`.
|
||||
`--max N` = how many pages from the sitemap to check (evenly from each language). Do not read
|
||||
the script's source — the output is enough.
|
||||
2. Show the full output. Fix every `[ERROR]` — each has a hint and a
|
||||
docs section. Typical causes:
|
||||
|
||||
| Błąd | Przyczyna → poprawka |
|
||||
| Error | Cause → fix |
|
||||
|---|---|
|
||||
| metadata rendered in `<body>` | brak `htmlLimitedBots`, jawny `<head>` w layoucie, brak ISR/`generateStaticParams`, `headers()`/`searchParams` w drzewie stron |
|
||||
| canonical not pointing to itself | `NEXT_PUBLIC_SERVER_URL` = localhost / inna domena; zły `homeSlug` |
|
||||
| noindex pages listed in the sitemap | stary build; pole noindex nie z `buildNoindexField` |
|
||||
| missing / non-self hreflang | strona bez sluga w innym języku; metadata nie z `generatePageMetadata` |
|
||||
| unknown URL returns 200 | brak `notFound()` w catch-all |
|
||||
| sitemap URLs not 200 | w sitemapie adresy z przekierowaniem (stare slugi) |
|
||||
| robots.txt points to localhost | `NEXT_PUBLIC_SERVER_URL` nieustawione w buildzie |
|
||||
| no JSON-LD structured data | brak `<SiteProviders>` / `<JsonLdGraph>` w `[locale]/layout.tsx` albo pusta nazwa w Site Settings |
|
||||
| `/llms.txt` / `/llms-full.txt` → 404 | brak trasy (`export { llmsRoute as GET }` / `llmsFullRoute` z `lib/content`) |
|
||||
| Markdown version `/md/…` → 404 | brak `src/app/md/[locale]/[[...slug]]/route.ts`; strona noindex/draft |
|
||||
| MCP not answering initialize | brak `src/app/api/mcp/route.ts` albo Cloudflare Access bez Bypass (mcp.md) |
|
||||
| metadata rendered in `<body>` | no `htmlLimitedBots`, explicit `<head>` in the layout, no ISR/`generateStaticParams`, `headers()`/`searchParams` in the page tree |
|
||||
| canonical not pointing to itself | `NEXT_PUBLIC_SERVER_URL` = localhost / another domain; wrong `homeSlug` |
|
||||
| noindex pages listed in the sitemap | stale build; the noindex field is not from `buildNoindexField` |
|
||||
| missing / non-self hreflang | page without a slug in another language; metadata not from `generatePageMetadata` |
|
||||
| unknown URL returns 200 | no `notFound()` in the catch-all |
|
||||
| sitemap URLs not 200 | the sitemap lists redirecting addresses (old slugs) |
|
||||
| robots.txt points to localhost | `NEXT_PUBLIC_SERVER_URL` not set in the build |
|
||||
| no JSON-LD structured data | no `<SiteProviders>` / `<JsonLdGraph>` in `[locale]/layout.tsx`, or an empty name in Site Settings |
|
||||
| `/llms.txt` / `/llms-full.txt` → 404 | no route (`export { llmsRoute as GET }` / `llmsFullRoute` from `lib/content`) |
|
||||
| Markdown version `/md/…` → 404 | no `src/app/md/[locale]/[[...slug]]/route.ts`; the page is noindex/draft |
|
||||
| `sitemap.xml → 503` | database unreachable while building the sitemap (`sitemapRoute` returns 503 + Retry-After instead of an empty one) — check `DATABASE_URL` / database health |
|
||||
| sitemap index parts not 200 | site > `maxUrls` (10 000) → `/sitemap.xml` is an index; the `?part=N` parts must answer 200 — your own route without `part` handling, or a CDN cache with an old part count |
|
||||
| MCP not answering initialize | no `src/app/api/mcp/route.ts`, or Cloudflare Access without a Bypass (mcp.md) |
|
||||
|
||||
3. `[WARNING]` oceń: brak opisu / zduplikowane tytuły to **treść w panelu** —
|
||||
uzupełnij z briefu albo wypisz w raporcie dla klienta.
|
||||
4. Uruchom ponownie aż `0 error(s)`.
|
||||
3. `no verification meta tag` (INFO — not counted as an error or warning) — with domain
|
||||
verification by DNS (recommended, docs/deployment.md §6) this is the correct state; do nothing. Only for
|
||||
URL-prefix verification, paste the code in **Site Settings → Search & AI**.
|
||||
`robots.txt blocks AI bots` — also check Site Settings → Search & AI → AI crawlers
|
||||
(when the project uses `getRobots`, the editor may have changed the policy).
|
||||
4. Judge each `[WARNING]`: a missing description / duplicate titles are **content in the panel** —
|
||||
fill them in from the brief or list them in the report for the client.
|
||||
5. Run again until `0 error(s)`.
|
||||
|
||||
## Czego skrypt nie sprawdzi
|
||||
Search Console (indeksacja, ręczne działania), Core Web Vitals, poprawność
|
||||
JSON-LD (obecność sprawdza; treść w Rich Results Test), treść merytoryczną.
|
||||
Pozycje pominięte z decyzji klienta czyta z `ipal-audit-skip:` w `AGENTS.md`.
|
||||
## What the script does not check
|
||||
Search Console (indexing, manual actions), Core Web Vitals, JSON-LD
|
||||
correctness (it checks presence; check content in the Rich Results Test), the substance of the content.
|
||||
Items skipped by client decision are read from `ipal-audit-skip:` in `AGENTS.md`.
|
||||
|
||||
@@ -29,7 +29,8 @@ let warnings = 0
|
||||
const findings = []
|
||||
const report = (level, title, rule, items = []) => {
|
||||
if (level === 'ERROR') errors += Math.max(items.length, 1)
|
||||
else warnings += Math.max(items.length, 1)
|
||||
else if (level === 'WARNING') warnings += Math.max(items.length, 1)
|
||||
// INFO: shown, never counted — a note, not a problem
|
||||
findings.push({ level, title, rule, items })
|
||||
}
|
||||
const get = async (path, opts = {}) => {
|
||||
@@ -73,14 +74,30 @@ else {
|
||||
const sitemap = await get('/sitemap.xml')
|
||||
let urls = []
|
||||
let hasAlternates = false
|
||||
if (sitemap.res.status !== 200) report('ERROR', `sitemap.xml → ${sitemap.res.status}`, 'export sitemap from lib/content + force-dynamic')
|
||||
const locs = (xml) => [...xml.matchAll(/<loc>\s*([^<\s]+)\s*<\/loc>/g)].map((m) => m[1].replace(/&/g, '&'))
|
||||
if (sitemap.res.status === 503) report('ERROR', 'sitemap.xml → 503', 'the database was unreachable while building it (sitemapRoute answers 503 + Retry-After) — check DATABASE_URL / DB health')
|
||||
else if (sitemap.res.status !== 200) report('ERROR', `sitemap.xml → ${sitemap.res.status}`, 'export sitemapRoute (or sitemap) from lib/content + force-dynamic')
|
||||
else {
|
||||
urls = [...new Set([...sitemap.text.matchAll(/<loc>\s*([^<\s]+)\s*<\/loc>/g)].map((m) => m[1]))]
|
||||
hasAlternates = /hreflang=/.test(sitemap.text)
|
||||
let xml = sitemap.text
|
||||
// Large sites: /sitemap.xml is a <sitemapindex> of parts (?part=N) — read every part.
|
||||
if (/<sitemapindex/i.test(xml)) {
|
||||
const parts = locs(xml)
|
||||
const broken = []
|
||||
xml = ''
|
||||
for (const part of parts.slice(0, 50)) {
|
||||
const r = await get(part).catch(() => null)
|
||||
if (!r || r.res.status !== 200) broken.push(`${part} → ${r?.res.status ?? 'unreachable'}`)
|
||||
else xml += r.text
|
||||
}
|
||||
console.log(`sitemap index: ${parts.length} part(s)`)
|
||||
if (broken.length) report('ERROR', 'sitemap index parts not 200', 'every <sitemap><loc> must answer 200 (seo.md → Large site)', broken)
|
||||
}
|
||||
urls = [...new Set(locs(xml))]
|
||||
hasAlternates = /hreflang=/.test(xml)
|
||||
if (urls.length === 0) report('ERROR', 'sitemap.xml is empty', 'DB unreachable at build without force-dynamic, or no published pages')
|
||||
const foreign = urls.filter((u) => !u.startsWith('http') || /localhost|127\.0\.0\.1/.test(u) !== /localhost|127\.0\.0\.1/.test(origin))
|
||||
if (foreign.length) report('ERROR', 'sitemap URLs relative or on another host', 'NEXT_PUBLIC_SERVER_URL / baseUrl', foreign.slice(0, 5))
|
||||
if (/(\/404|\/500|not-found)(\/|<|$)/.test(sitemap.text)) report('ERROR', 'error pages listed in the sitemap', 'pages.md — 404 page is excluded by ID')
|
||||
if (/(\/404|\/500|not-found)(\/|<|$)/.test(xml)) report('ERROR', 'error pages listed in the sitemap', 'pages.md — 404 page is excluded by ID')
|
||||
}
|
||||
|
||||
// --- 4. sampled pages -----------------------------------------------------
|
||||
@@ -194,7 +211,7 @@ if (issues.reciprocal.length) report('WARNING', 'hreflang alternates not in the
|
||||
if (issues.desc.length) report('WARNING', 'missing meta description', 'fill SEO tab in the panel (or site description fallback)', issues.desc)
|
||||
if (dupTitles.length) report('WARNING', 'duplicate titles', 'unique meta titles per page', dupTitles)
|
||||
if (dupDescs.length) report('WARNING', 'duplicate meta descriptions (Google ignores them)', 'own description per page in the SEO tab — empty ones auto-fill from content on save', dupDescs)
|
||||
if (issues.footerSnippet.length) report('WARNING', 'footer without data-nosnippet (Google quotes the address as the snippet)', 'wrap footer contents in <NoSnippet> (seo.md → Opisy w Google)', issues.footerSnippet.slice(0, 3))
|
||||
if (issues.footerSnippet.length) report('WARNING', 'footer without data-nosnippet (Google quotes the address as the snippet)', 'wrap footer contents in <NoSnippet> (seo.md → Descriptions in Google)', issues.footerSnippet.slice(0, 3))
|
||||
if (issues.longTitle.length) report('WARNING', 'titles over 65 chars (truncated in results)', 'shorten in the SEO tab', issues.longTitle)
|
||||
if (issues.favicon.length) report('WARNING', 'no favicon link in head', 'buildIconsMetadata(settings.favicon) in root generateMetadata', issues.favicon.slice(0, 3))
|
||||
if (issues.xRobots.length) report('ERROR', 'X-Robots-Tag: noindex on pages', 'IPAL_NOINDEX is set in this environment — remove it in production', issues.xRobots.slice(0, 3))
|
||||
@@ -209,6 +226,17 @@ if (issues.noLinks.length) report('WARNING', 'pages without internal links', 'li
|
||||
if (!skipped('jsonld') && issues.jsonLd.length) report('ERROR', 'no JSON-LD structured data', '<JsonLdGraph> WebSite + Organization in [locale]/layout.tsx (AGENT.md §0b.4)', issues.jsonLd.slice(0, 5))
|
||||
if (!skipped('markdown') && issues.mdAlt.length) report('WARNING', 'no text/markdown alternate link in head', 'createContentHelpers({ markdownAlternate: true }) (AGENT.md §0b.6)', issues.mdAlt.slice(0, 3))
|
||||
|
||||
// --- 4b. Search Console / Bing verification tags (Site Settings → Search & AI) ----
|
||||
// INFO only: domain (DNS) verification — the recommended route — leaves the tags empty.
|
||||
if (!skipped('verification') && sample.length) {
|
||||
const page = await get(sample[0]).catch(() => null)
|
||||
const head = page?.text.split(/<\/head>/i)[0] ?? ''
|
||||
const missing = [['google-site-verification', 'Google Search Console'], ['msvalidate.01', 'Bing Webmaster Tools']]
|
||||
.filter(([name]) => !new RegExp(`<meta[^>]+name="${name}"`, 'i').test(head))
|
||||
.map(([, label]) => label)
|
||||
if (missing.length) report('INFO', 'no verification meta tag (fine with DNS / domain verification)', 'only for URL-prefix verification: paste the code in Site Settings → Search & AI', missing)
|
||||
}
|
||||
|
||||
// --- 5. 404 ---------------------------------------------------------------
|
||||
const firstLocale = [...byLocale.keys()].find((l) => l && l.length <= 5) ?? ''
|
||||
for (const path of [`/${firstLocale ? firstLocale + '/' : ''}ipal-seo-check-${Date.now()}`]) {
|
||||
|
||||
@@ -89,34 +89,19 @@ export const i18nConfig = {
|
||||
import type { ContentOption } from '@intecion/ipal-kit'
|
||||
export const contentConfig: ContentOption = { collections: [] }
|
||||
|
||||
// src/hooks/revalidateGlobals.ts — the plugin does NOT revalidate globals (hooks.md)
|
||||
import { revalidatePath } from 'next/cache'
|
||||
import type { GlobalAfterChangeHook } from 'payload'
|
||||
export const revalidateEverything: GlobalAfterChangeHook = ({ doc, context }) => {
|
||||
if (!process.env.NEXT_RUNTIME || context?.disableRevalidate) return doc
|
||||
revalidatePath('/', 'layout')
|
||||
return doc
|
||||
}
|
||||
```
|
||||
```ts
|
||||
// src/payload.config.ts — keep from create-payload-app: db, editor, secret, sharp, typescript, admin.importMap
|
||||
import { buildConfig, type Plugin } from 'payload'
|
||||
import { buildConfig } from 'payload'
|
||||
import { revalidatePath } from 'next/cache'
|
||||
import { buildR2Storage, ipalKit, mailAdapter } from '@intecion/ipal-kit'
|
||||
import { payloadTotp } from '@clocklimited/payload-2fa'
|
||||
import { s3Storage } from '@payloadcms/storage-s3'
|
||||
import { i18nConfig } from '@/i18n.config'
|
||||
import { contentConfig } from '@/content.config'
|
||||
import { revalidateEverything } from '@/hooks/revalidateGlobals'
|
||||
import { Pages } from '@/collections/Pages'
|
||||
import { Media } from '@/collections/Media'
|
||||
|
||||
const PLUGIN_GLOBALS = ['site-settings', 'site-integrations', 'cookie-settings', 'notifications']
|
||||
const revalidatePluginGlobals: Plugin = (config) => ({
|
||||
...config,
|
||||
globals: config.globals?.map((g) => PLUGIN_GLOBALS.includes(g.slug)
|
||||
? { ...g, hooks: { ...g.hooks, afterChange: [...(g.hooks?.afterChange ?? []), revalidateEverything] } } : g),
|
||||
})
|
||||
|
||||
export default buildConfig({
|
||||
// …db, editor, secret, sharp, typescript from create-payload-app…
|
||||
collections: [Pages, Media], // ipalKit injects users
|
||||
@@ -133,8 +118,8 @@ export default buildConfig({
|
||||
whiteLabel: true,
|
||||
indexNow: true,
|
||||
consentLog: true, // without this there is no POST /api/ipal/consent
|
||||
revalidatePath, // saving a plugin global refreshes the whole site (ISR)
|
||||
}),
|
||||
revalidatePluginGlobals, // AFTER ipalKit — the plugin globals already exist
|
||||
buildR2Storage(['media'], { s3Storage }), // ALWAYS: R2 with the full R2_* set, local disk without it
|
||||
],
|
||||
})
|
||||
@@ -153,17 +138,24 @@ the panel shows Site Settings, Site Integrations, Cookie Settings, Notifications
|
||||
-d '{"id":"0123456789abcdef","version":1,"state":{"necessary":true,"functional":false,"analytics":false,"marketing":false}}'` → `201`.
|
||||
|
||||
**Turn off / override.**
|
||||
- `enabled: false` — `ipalKit` returns the config unchanged: the plugin's collections and globals **disappear from the config**
|
||||
(Postgres: do not approve a migration/push that drops tables).
|
||||
- `enabled: false` — collections, globals and fields stay (schema unchanged, `migrate:create` drops nothing);
|
||||
no `/api/ipal/*` endpoints, no `onInit` work, no admin components.
|
||||
- Omitted option = module off: `seo`, `forms`, `pages` (without it `content` does not work), `content`,
|
||||
`consentLog`, `indexNow`, `whiteLabel`, `access`, `stats`.
|
||||
- `twoFactor`: **omitting it throws** (`issuer` is required) — turn it off only explicitly with `twoFactor: false`
|
||||
(discouraged); without an injected `plugin: payloadTotp` it also throws. `forceSetup` currently always `true`.
|
||||
- `users`: your own collection with that slug wins (the plugin only adds `roles`). `localization` currently always
|
||||
- `users`: the injected collection lets admins manage everyone and others only themselves — loosen with
|
||||
`access: { authCollection: 'users', authAccess: { read: authenticated } }` (your keys win); your own collection with
|
||||
that slug wins whole (the plugin only adds `roles` — give it `adminOrSelf` / `adminOnly`). The first account
|
||||
(Create first user) gets `admin` — `access.firstUserAdmin: false` turns that off. `localization` currently always
|
||||
overridden from `i18n`.
|
||||
- The `site-settings`, `site-integrations`, `cookie-settings`, `notifications` globals, the
|
||||
`/api/ipal/test-email` endpoint and dashboard alerts — currently always; extend `siteSettingsFields` /
|
||||
`integrationsFields`, remove/replace them with your own plugin after `ipalKit` (like `revalidatePluginGlobals`).
|
||||
- 2FA wraps the panel's login collection (`admin.user`); a different `twoFactor.collectionSlug` stops startup with
|
||||
`[ipal] twoFactor…` unless `allowCollectionMismatch: true`.
|
||||
- The `site-settings`, `site-integrations`, `cookie-settings`, `notifications` globals (write: editor+; Site
|
||||
Integrations: admin), the `/api/ipal/test-email` endpoint and dashboard alerts — currently always present; extend
|
||||
`siteSettingsFields` / `integrationsFields`; change access, admin or hooks with
|
||||
`globalOverrides: { notifications: { access: { update: authenticated } } }` (object = merged key by key, your keys
|
||||
win; a function `(global) => global` takes over). Without `revalidatePath` global saves wait for the ISR window.
|
||||
- `whiteLabel: { credit: false, titleSuffix, settingsSlug, logoField, … }`; with `whiteLabel` the plugin overrides
|
||||
`graphics.Logo/Icon` — your own graphics only without it.
|
||||
- Mail: any Payload adapter instead of `mailAdapter()`; `mailAdapter({ fallbackFromAddress, smtp, graph })`.
|
||||
@@ -307,7 +299,9 @@ and `rel="alternate" type="text/markdown"`; `/pl/nie-ma-takiej` → 404 with con
|
||||
- `createProxy`: `markdown: '/ai'` (another prefix), `exposeHeaders: false`, `cookieName`, `consentCategory`;
|
||||
a fully custom proxy on `createLocaleMiddleware`. The matcher belongs to the project.
|
||||
- `createContentHelpers`: skip any key or replace it with your own function of that name in `lib/content.ts`;
|
||||
`siteJsonLd: false` (no WebSite/Organization), `pageJsonLd`, `robots`, `sitemapStyle`, `markdownAlternate: false`.
|
||||
`siteJsonLd: false` (no WebSite/Organization), `pageJsonLd`, `robots`, `sitemapStyle`, `markdownAlternate: false`,
|
||||
`settingsDepth`, `sitemapOptions`, `sitemapEntries`, `underConstructionSeo: false`; construction filter off in Markdown/MCP:
|
||||
`markdown: { isPathVisible: () => true }`, `mcp: { isPathVisible: () => true }`.
|
||||
- `createPageRoute`: `render` (your own view, e.g. an archive), `onMissing: 'redirectHome'`, `jsonLd: false`,
|
||||
`homeAlias: false`, `layoutField`; a fully custom page on `resolveRoute` (pages.md).
|
||||
`generateStaticParams` covers **only the pages collection, up to 1000 per language** — the scope is currently fixed (entries → ISR).
|
||||
@@ -324,7 +318,7 @@ and `rel="alternate" type="text/markdown"`; `/pl/nie-ma-takiej` → 404 with con
|
||||
| File | Content |
|
||||
|---|---|
|
||||
| `src/app/sitemap.xml/route.ts` | `export { sitemapRoute as GET } from '@/lib/content'` + `export const dynamic = 'force-dynamic'` |
|
||||
| `src/app/robots.ts` | `export { robots as default } from '@/lib/content'` |
|
||||
| `src/app/robots.ts` | `export { getRobots as default } from '@/lib/content'` + `force-dynamic` (AI crawler policy from Site Settings → Search & AI; `robots` = code only) |
|
||||
| `src/app/manifest.ts` | `export { manifest as default } from '@/lib/content'` + `force-dynamic` |
|
||||
| `src/app/api/health/route.ts` | `export { healthRoute as GET } from '@/lib/content'` + `force-dynamic` |
|
||||
|
||||
@@ -361,7 +355,8 @@ export function register() {
|
||||
|
||||
**Check.** `curl -s localhost:3000/sitemap.xml | head` → `<urlset` with `xhtml:link hreflang`; in the browser
|
||||
the "XML Sitemap" style; `curl -s localhost:3000/robots.txt` → `Sitemap:`, `Disallow: /admin`, AI bots (GPTBot,
|
||||
ClaudeBot…) with `Allow`; `/manifest.webmanifest` → JSON with the name from Site Settings; `/api/health` → `200`
|
||||
ClaudeBot…) with `Allow` (a policy picked in Site Settings → Search & AI → AI crawlers shows up after a reload);
|
||||
`curl -sI localhost:3000/sitemap.xml | grep -i cache-control` → `s-maxage=3600`; `/manifest.webmanifest` → JSON with the name from Site Settings; `/api/health` → `200`
|
||||
(`503` without a database); `curl -sI localhost:3000/pl | grep -i 'x-frame-options\|content-security-policy-report-only'`;
|
||||
an empty `PAYLOAD_SECRET` in `.env` → `pnpm dev` exits with a list of missing variables (restore it).
|
||||
|
||||
@@ -370,7 +365,18 @@ an empty `PAYLOAD_SECRET` in `.env` → `pnpm dev` exits with a list of missing
|
||||
or your own text; `buildSecurityHeaders({ frameOptions, coop, hsts, additional })` — an `additional` entry with the same key
|
||||
overrides the default; CSP: `buildCsp` flags (`youtube`, `googleMaps`, `extra`), after a clean console `mode: 'enforce'`;
|
||||
`buildImagesConfig({ extraHosts })`; env validation is fully opt-in — filter/add rules
|
||||
(`ipalEnvRules(…).filter(…)`). Staging: `IPAL_NOINDEX=1`.
|
||||
(`ipalEnvRules(…).filter(…)`). Staging: `IPAL_NOINDEX=1` (also stops IndexNow). Search & AI: `robots` instead of
|
||||
`getRobots` ignores the panel; `seo: { …, searchSettings: false }` removes the tab; per-bot exceptions in code:
|
||||
`createContentHelpers({ robots: { aiBotRules: [{ userAgent, access }] } })`. Sitemap: `sitemapOptions: { maxUrls,
|
||||
cacheControl, memoSeconds }`, `sitemapEntries: (entries) => entries` (add/remove URLs), `underConstructionSeo: false`.
|
||||
|
||||
**Search & AI panel step.** Nothing in code — the tab exists by default. **Postgres:** after installing or upgrading
|
||||
the plugin run `pnpm payload migrate:create` (new columns `search_verification_*`, `ai_crawlers_policy`, the
|
||||
`ai_crawlers_rules` table, localized `llms_intro`) → `pnpm payload migrate`; SQLite/Mongo: nothing. Search Console:
|
||||
verify the **domain via DNS** (stage 11) and leave the verification fields empty; only for URL-prefix verification
|
||||
paste the code into Site Settings → Search & AI (never into code). `llmsIntro` (per language): 2–4 sentences of facts
|
||||
from the brief (who, what, where, since when, for whom) — it goes at the top of `/llms.txt`. Check:
|
||||
`curl -s localhost:3000/llms.txt | head` (the note under the description).
|
||||
|
||||
## 8. GEO (mandatory)
|
||||
|
||||
@@ -416,15 +422,19 @@ after a choice in the banner a new record in Consent records.
|
||||
`turnstileOnConfigError: 'reject'`; the Turnstile/SMTP fields in Site Integrations currently always. Form look:
|
||||
`formClasses`, unusual ones → `useBuilderForm` (no copy of the engine). Banner: `settings`, `controls`, `order`,
|
||||
`equalChoice`, `classNames`, tokens; no `consentLog` = no register and no endpoint (then remove `logEndpoint`).
|
||||
**GA4/GTM load before consent in Consent Mode v2 with `denied`** (pixels and Clarity only after consent) — currently
|
||||
always, basic mode cannot be turned on by an option; a client requiring zero requests to Google → note it in the report /
|
||||
**plugin gap** (`ipal-plugin-gap`). Analytics: empty IDs in the panel or `analytics={false}`.
|
||||
**Consent Mode choice** (record it in "Project decisions"): `'advanced'` (default) — the Google tag loads at once with
|
||||
every signal `denied` (pixels and Clarity only after consent); `'basic'` — `<SiteProviders analytics={{ consentMode: 'basic' }}>`,
|
||||
no request to `googletagmanager.com` before analytics or marketing consent (a client requiring zero requests to Google).
|
||||
Check in `basic`: DevTools → Network shows no `gtm.js` / `gtag/js` before consent. Analytics: empty IDs in the panel or
|
||||
`analytics={false}`. Forms: `createSubmitAction({ turnstileHostnames: ['client.pl'] })` rejects a token solved on
|
||||
another domain (leave it empty in dev — Cloudflare test keys report `example.com`). The locale cookie respects consent;
|
||||
after an editor bumps Cookie Settings → Policy version nothing to change (`createProxy(config, { policyVersion })` pins one).
|
||||
|
||||
## 10. Navigation
|
||||
|
||||
**Steps.** Skill **ipal-nav**: Header/Footer/Company globals (`buildLinkField`/`buildLinksField`, `resolveNav`,
|
||||
legal links via `getSystemLinks(locale)`), `afterChange` with `revalidatePath('/', 'layout')` on **your own**
|
||||
globals (`revalidateEverything` from stage 3), Header/Footer in the layout, optionally
|
||||
legal links via `getSystemLinks(locale)`), `afterChange: [buildGlobalRevalidateHook({ revalidatePath })]` on **your own**
|
||||
globals (the plugin's globals already refresh with `ipalKit({ revalidatePath })` from stage 3), Header/Footer in the layout, optionally
|
||||
`<SiteProviders jsonLd={[buildNavigationJsonLd(…)]}>`.
|
||||
|
||||
**Check.** A menu item change in the panel is visible on `/pl` right after saving; a link to a page in EN leads to
|
||||
@@ -446,7 +456,7 @@ relationTo, appearances: false, disableLabel })`, `LanguageSwitcher` (`className
|
||||
**Commands (all must pass):**
|
||||
```bash
|
||||
pnpm generate:types && pnpm payload generate:importmap
|
||||
pnpm payload migrate:create # Postgres with migrations only
|
||||
pnpm payload migrate:create # Postgres with migrations only — also after every ipal-kit upgrade (new plugin fields)
|
||||
bash .agents/skills/ipal-audit/scripts/audit.sh # full: §0b "missing: …" = 0, tsc, build
|
||||
pnpm build && pnpm start
|
||||
node .agents/skills/ipal-seo-check/scripts/seo-check.mjs http://localhost:3000 # 0 errors
|
||||
@@ -505,7 +515,7 @@ prepare the list with values, a human adds them, you verify with `dig`). Full ta
|
||||
From domain: SMTP from the panel → the domain of the *From address* (records from the mailbox provider); Graph → From is
|
||||
always `GRAPH_SENDER` (agency domain, set once — nothing in the project). After DNS: *Send test* and in the received
|
||||
email `Authentication-Results: spf=pass dkim=pass dmarc=pass`. We verify Search Console **via DNS** —
|
||||
meta-tag verification fields in Site Settings (if any) stay **empty**; submit the sitemap `https://client.pl/sitemap.xml`
|
||||
the verification fields in Site Settings → Search & AI stay **empty** (only URL-prefix verification uses them; the plugin then adds the `<meta>` itself); submit the sitemap `https://client.pl/sitemap.xml`
|
||||
once by hand in GSC and Bing (no API). Turnstile, IndexNow, llms, MCP — no DNS.
|
||||
|
||||
Final report: what is wired, what is missing (data, keys, decisions), the DNS record list with values (`dig` status), every `ipal-audit-skip`, any
|
||||
|
||||
@@ -55,6 +55,17 @@ a custom table of contents (→ `extractHeadings` + `TableOfContents` + `heading
|
||||
the banner → `<CookieBanner settings="detailed">` and remove the copy. With `detailed`: Cookie Settings → Cookies filled in
|
||||
(scan, **ipal-consent-check**) and Detail labels in every language.
|
||||
|
||||
**→ the release after 1.12.3 (security/performance + SEO):** Postgres: `migrate:create` → `migrate` (Site Settings →
|
||||
Search & AI: `search_verification_*`, `ai_crawlers_policy`, the `ai_crawlers_rules` table, localized `llms_intro`).
|
||||
Remove the workarounds: a plugin after `ipalKit` that adds `afterChange` to the plugin globals → `ipalKit({ revalidatePath })`;
|
||||
a hand-written global revalidation hook → `buildGlobalRevalidateHook({ revalidatePath })`; a plugin that rewrites the access
|
||||
of a plugin global → `globalOverrides`; `consentFieldName` passed only because the option was ignored → `forms.consentFieldName`
|
||||
works now. `app/robots.ts` → `export { getRobots as default }` + `force-dynamic`; `createSearchRoute({ …, isPathVisible })`.
|
||||
Behaviour to check: `getSettings` reads at `depth: 1` (code that reads a relation of a relation → `settingsDepth: 2`);
|
||||
`sitemap()` throws at runtime instead of returning `[]` (`sitemapRoute` answers 503); the injected `users` collection is
|
||||
locked down (`access.authAccess` to loosen); a `twoFactor.collectionSlug` other than `admin.user` stops startup
|
||||
(`allowCollectionMismatch`); requests without a client IP are limited (`setUnknownIpFactor`); `enabled: false` keeps the schema.
|
||||
|
||||
## 2. Inventory (no code changes)
|
||||
For **every** item in the PROGRAMISTA §6 table show evidence (grep / file) of whether
|
||||
it applies to the project. Run the **ipal-audit** skill (`--quick`) and attach the result.
|
||||
|
||||
Reference in New Issue
Block a user