Docs for 1.10: mandatory set (18 items), setup skill, reference code, module docs, changelog
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+39
-17
@@ -132,6 +132,8 @@ export default buildConfig({
|
||||
forms: { redirectRelationships: ['pages'] },
|
||||
twoFactor: { issuer: 'Nazwa Klienta', plugin: payloadTotp },
|
||||
whiteLabel: true, // logo/nazwa z Site Settings w panelu
|
||||
indexNow: true, // publikacja → Bing / ChatGPT Search (produkcja)
|
||||
consentLog: true, // dowód zgody (RODO art. 7 ust. 1), bez danych osobowych
|
||||
// adminRoute: '/its', // + przenieś app/(payload)/admin → its
|
||||
}),
|
||||
buildR2Storage(['media'], { s3Storage }), // ZAWSZE — R2 przy komplecie R2_* w env, dysk lokalny bez nich
|
||||
@@ -212,7 +214,7 @@ import { i18nConfig } from '@/i18n.config'
|
||||
import { contentConfig } from '@/content.config'
|
||||
|
||||
export const {
|
||||
getCachedPayload, getSettings, getConfiguredLocales, resolveRoute, getEntries,
|
||||
getCachedPayload, getSettings, getConfiguredLocales, resolveRoute, getEntries, getPageJsonLd,
|
||||
generatePageMetadata, getNotFoundPage, generateStaticParams, sitemap, robots,
|
||||
} = createContentHelpers({
|
||||
config,
|
||||
@@ -220,6 +222,7 @@ export const {
|
||||
i18n: i18nConfig,
|
||||
baseUrl: process.env.NEXT_PUBLIC_SERVER_URL,
|
||||
markdownAlternate: true, // GEO: <link rel="alternate" type="text/markdown"> w każdej stronie
|
||||
// pageJsonLd: { faq: (doc) => …mapowanie bloku FAQ na { question, answer }… },
|
||||
})
|
||||
```
|
||||
|
||||
@@ -228,7 +231,7 @@ export const {
|
||||
// src/app/(frontend)/[locale]/layout.tsx
|
||||
import { notFound } from 'next/navigation'
|
||||
import {
|
||||
buildOrganizationJsonLd, buildWebSiteJsonLd, getAnalyticsConfig, getConsentTexts, getTurnstileConfig,
|
||||
buildOrganizationJsonLd, buildWebSiteJsonLd, getAnalyticsConfig, getConsentTexts, getTurnstileConfig, sameAsUrls,
|
||||
} from '@intecion/ipal-kit'
|
||||
import { Analytics, ConsentProvider, CookieBanner, CookieButton, TurnstileProvider } from '@intecion/ipal-kit/client'
|
||||
import { JsonLdGraph, MediaPreconnect } from '@intecion/ipal-kit/rsc'
|
||||
@@ -252,7 +255,10 @@ export default async function LocaleLayout({ children, params }: Props) {
|
||||
const url = process.env.NEXT_PUBLIC_SERVER_URL
|
||||
const name = typeof settings?.siteName === 'string' ? settings.siteName : undefined
|
||||
// Dane z panelu; brak → węzeł pominięty (nigdy fallback z nazwą klienta). Firma lokalna: buildLocalBusinessJsonLd z globalu Company.
|
||||
const schemas = name && url ? [buildWebSiteJsonLd({ name, url }), buildOrganizationJsonLd({ name, url })] : []
|
||||
const schemas = name && url
|
||||
? [buildWebSiteJsonLd({ name, url }), buildOrganizationJsonLd({ name, url, logo: settings.logo, sameAs: sameAsUrls(settings) })]
|
||||
: []
|
||||
// + buildNavigationJsonLd({ items: header.navItems, … }) z globala nagłówka (seo.md)
|
||||
|
||||
return (
|
||||
<html lang={locale}>
|
||||
@@ -260,11 +266,11 @@ export default async function LocaleLayout({ children, params }: Props) {
|
||||
<body>
|
||||
<MediaPreconnect />
|
||||
<JsonLdGraph schemas={schemas} />
|
||||
<ConsentProvider texts={texts}>
|
||||
<ConsentProvider texts={texts} logEndpoint="/api/ipal/consent">
|
||||
<TurnstileProvider siteKey={turnstile.siteKey}> {/* zawsze — sam się wyłącza bez kluczy */}
|
||||
<main>{children}</main>
|
||||
</TurnstileProvider>
|
||||
<CookieBanner />
|
||||
<CookieBanner equalChoice />
|
||||
<CookieButton />
|
||||
<Analytics {...analytics} /> {/* wewnątrz providera; opcja defer — analytics.md */}
|
||||
</ConsentProvider>
|
||||
@@ -278,11 +284,11 @@ export default async function LocaleLayout({ children, params }: Props) {
|
||||
// src/app/(frontend)/[locale]/[[...slug]]/page.tsx — PODWÓJNE nawiasy
|
||||
import { notFound, permanentRedirect } from 'next/navigation'
|
||||
import type { Metadata } from 'next'
|
||||
import { RenderBlocks } from '@intecion/ipal-kit/rsc'
|
||||
import { JsonLdGraph, RenderBlocks } from '@intecion/ipal-kit/rsc'
|
||||
import { resolveRedirect } from '@intecion/ipal-kit'
|
||||
import { i18nConfig } from '@/i18n.config'
|
||||
import { blockRegistry } from '@/blocks/registry'
|
||||
import { generatePageMetadata, getCachedPayload, resolveRoute } from '@/lib/content'
|
||||
import { generatePageMetadata, getCachedPayload, getPageJsonLd, resolveRoute } from '@/lib/content'
|
||||
|
||||
export { generateStaticParams } from '@/lib/content' // SSG → <head> synchroniczny
|
||||
export const revalidate = 3600 // ISR
|
||||
@@ -305,7 +311,12 @@ export default async function Page({ params }: Args) {
|
||||
}
|
||||
const enhanceProps = () => ({ locale }) // locale dla CMSLink w blokach
|
||||
const doc = route.doc as { layout?: unknown[] }
|
||||
return <RenderBlocks blocks={doc.layout as never} components={blockRegistry} enhanceProps={enhanceProps} />
|
||||
return (
|
||||
<>
|
||||
<JsonLdGraph schemas={await getPageJsonLd(locale, slug)} /> {/* WebPage/BlogPosting, okruszki, FAQ */}
|
||||
<RenderBlocks blocks={doc.layout as never} components={blockRegistry} enhanceProps={enhanceProps} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
```
|
||||
Opcje `resolveRedirect` (`collections`, `homeSlug`): content.md.
|
||||
@@ -336,15 +347,17 @@ export const dynamic = 'force-dynamic'
|
||||
export const GET = createLlmsTxtRoute({ getCachedPayload, config: i18nConfig,
|
||||
baseUrl: process.env.NEXT_PUBLIC_SERVER_URL!, summaryField: 'aiSummary' })
|
||||
|
||||
// src/app/md/[locale]/[[...slug]]/route.ts — każda strona jako Markdown
|
||||
import { createMarkdownRenderer, markdownResponse } from '@intecion/ipal-kit'
|
||||
// src/app/md/[locale]/[[...slug]]/route.ts — każda strona jako Markdown (noindex + canonical do HTML)
|
||||
import { createMarkdownRoute } from '@intecion/ipal-kit'
|
||||
import { contentConfig } from '@/content.config'
|
||||
const render = createMarkdownRenderer({ content: contentConfig })
|
||||
export const dynamic = 'force-dynamic'
|
||||
export async function GET(_req: Request, { params }: { params: Promise<{ locale: string; slug?: string[] }> }) {
|
||||
const { locale, slug } = await params
|
||||
return markdownResponse(await render({ payload: await getCachedPayload(), locale, slug }))
|
||||
}
|
||||
export const { GET } = createMarkdownRoute({ getCachedPayload, content: contentConfig, config: i18nConfig,
|
||||
baseUrl: process.env.NEXT_PUBLIC_SERVER_URL })
|
||||
|
||||
// src/app/indexnow-key.txt/route.ts — klucz IndexNow (z Site Integrations albo INDEXNOW_KEY)
|
||||
import { createIndexNowKeyRoute } from '@intecion/ipal-kit'
|
||||
export const dynamic = 'force-dynamic'
|
||||
export const GET = createIndexNowKeyRoute({ getCachedPayload })
|
||||
|
||||
// src/app/api/mcp/route.ts — publiczny serwer MCP (AI przegląda stronę)
|
||||
import { createMcpRoute } from '@intecion/ipal-kit'
|
||||
@@ -367,15 +380,16 @@ przez `createContentHelpers({ sitemapStyle })` (seo.md).
|
||||
```ts
|
||||
// next.config.ts
|
||||
import { withPayload } from '@payloadcms/next/withPayload'
|
||||
import { buildSecurityHeaders } from '@intecion/ipal-kit'
|
||||
import { buildImagesConfig, buildSecurityHeaders, buildUploadSecurityHeaders } from '@intecion/ipal-kit'
|
||||
|
||||
const securityHeaders = buildSecurityHeaders({ hsts: process.env.NODE_ENV === 'production' })
|
||||
|
||||
export default withPayload({
|
||||
images: { ...buildImagesConfig() }, // AVIF/WebP, domena R2 (R2_PUBLIC_URL), cache 31 dni
|
||||
htmlLimitedBots:
|
||||
/Googlebot|Google-InspectionTool|Storebot-Google|Bingbot|Yandex|DuckDuckBot|Baiduspider|Screaming Frog|AhrefsBot|SemrushBot/i,
|
||||
async headers() {
|
||||
return [{ source: '/:path*', headers: securityHeaders }]
|
||||
return [{ source: '/:path*', headers: securityHeaders }, ...buildUploadSecurityHeaders()]
|
||||
},
|
||||
})
|
||||
```
|
||||
@@ -414,6 +428,8 @@ pnpm dev
|
||||
| `NEXT_PUBLIC_SERVER_URL` | ✅ | publiczny URL (canonical, hreflang, OG); bez niego linki względne |
|
||||
| `GRAPH_TENANT_ID`, `GRAPH_CLIENT_ID`, `GRAPH_CLIENT_SECRET`, `GRAPH_SENDER` | ⬜ | email przez Microsoft Graph |
|
||||
| `R2_BUCKET`, `R2_ENDPOINT`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_PUBLIC_URL` | ✅ prod | media w Cloudflare R2 — na produkcji zawsze (brak → dysk kontenera, pliki znikają przy redeployu); w dev mogą być puste |
|
||||
| `IPAL_NOINDEX` | ⬜ | `1` **tylko na stagingu / preview** — cała strona poza Google (robots, meta, nagłówek) |
|
||||
| `INDEXNOW_KEY` | ⬜ | klucz IndexNow, gdy nie z panelu (Site Integrations → IndexNow generuje sam) |
|
||||
| `IPAL_IP_HEADER` | ✅ prod | nagłówek z prawdziwym IP dla rate limitu: `cf-connecting-ip` za Cloudflare, `x-forwarded-for` za samym Traefikiem/nginx (forms.md) |
|
||||
| `NEXT_PUBLIC_TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` | ⬜ | fallback, gdy kluczy Turnstile nie ma w panelu |
|
||||
|
||||
@@ -545,6 +561,12 @@ Rób po jednej pozycji, buduj, sprawdzaj. Kolejność wg wagi:
|
||||
| 19 | **1.9.0** — `twoFactor: { issuer }` bez `plugin` | dopisz `plugin: payloadTotp` (fallback z dynamicznym importem usunięty — start kończy się błędem) | security.md |
|
||||
| 20 | **1.9.0** — IP w akcji formularza liczone ręcznie z `x-forwarded-for` | `clientIp(await headers())` + `IPAL_IP_HEADER` w env produkcji | forms.md |
|
||||
| 21 | **1.9.0** — media bez R2 na produkcji / brak `buildR2Storage` | wpnij `buildR2Storage(['media'], { s3Storage })`, ustaw `R2_*` | storage.md |
|
||||
| 22 | **1.10** — ręczny `actions.ts` / trasa `md` / brak seeda formularza | `createSubmitAction`, `createMarkdownRoute`, seed z `ipal-form` (mail do firmy + do klienta) | forms.md, content.md |
|
||||
| 23 | **1.10** — `createProxy` bez `markdown: true` | dopisz — inaczej `/md/…` przekierowuje na `/pl/md/…` | content.md |
|
||||
| 24 | **1.10** — JSON-LD strony składany ręcznie | `getPageJsonLd`, `buildNavigationJsonLd`, `sameAsUrls`, `formatOpeningHours` | seo.md |
|
||||
| 25 | **1.10** — zgoda: wersja, rejestr, tabela | Cookie Settings → Policy version; `consentLog: true` + `logEndpoint`; `<CookieBanner equalChoice>`; skan + `<CookieTable>`; Postgres: `migrate:create` | consent.md |
|
||||
| 26 | **1.10** — media: `priority`, brak placeholderów, `images` w next.config | `<Media>` przez `mediaImageProps`/`videoProps`, `buildMediaPlaceholderHook`, `buildImagesConfig`, `buildUploadSecurityHeaders` | storage.md |
|
||||
| 27 | **1.10** — staging indeksowany | `IPAL_NOINDEX=1` w env stagingu | seo.md |
|
||||
|
||||
Po aktualizacji pakietu: `pnpm ipal:skills` (nowe wersje skilli), `pnpm payload generate:importmap`, `rm -rf .next`, restart dev, grep nowego symbolu w
|
||||
`node_modules/@intecion/ipal-kit/dist`.
|
||||
|
||||
Reference in New Issue
Block a user