SEO/GEO tools and project requests: site index, IndexNow, page JSON-LD, fixes
GEO / SEO
- collectSiteIndex: one list of public docs per locale (pages + archive
entries) on sitemap rules; llms.txt/llms-full and MCP list_pages now include
blog/content entries and every language. Fixes hard-coded "## Strony" heading
and homepage not collapsing to the locale root in llms.txt.
- Markdown frontmatter: canonical url + updated date.
- Metadata: X/Twitter card, OG image width/height/alt, og:type article with
published/modified times for entries.
- Fix: Site Settings "defaultShareImage" was never used — now the OG fallback.
- getPageJsonLd (createContentHelpers): WebPage/CollectionPage/BlogPosting,
BreadcrumbList from the real route, FAQPage via a project mapper.
- IndexNow (opt-in ipalKit({ indexNow: true })): submit published URLs in all
languages, key generated in Site Integrations or INDEXNOW_KEY, key route.
- sameAs profiles in Site Settings + sameAsUrls(); sitemap <image:image>.
From project reports
- Fix: package exports were missing ./env and ./fluid.css although the docs
import them (TS2307); regression test checks every documented subpath.
- Fix: plugins run before Payload adds its default users collection, so roles
and 2FA had nothing to attach to — ipalKit injects an auth collection when
the project has none (project's own one wins). Audit no longer errors on it.
- createMarkdownRoute, createSubmitAction (/server, headers injected).
- formatOpeningHours (PL/EN/DE text → schema.org), used by
buildLocalBusinessJsonLd, which also takes a schema.org `type`.
- buildNavigationJsonLd straight from the header global.
- buildCsp googleMaps: full Maps JS API domain set; values de-duplicated.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
import 'server-only'
|
||||
import type { BasePayload } from 'payload'
|
||||
|
||||
import type { ClientIpOptions } from '../shared/rateLimit.js'
|
||||
import type { SubmitFormArgs, SubmitFormResult } from './submitForm.js'
|
||||
|
||||
import { getNotificationTexts } from '../notifications/getNotificationTexts.js'
|
||||
import { resolveFormMessage } from '../notifications/resolveFormMessage.js'
|
||||
import { clientIp } from '../shared/rateLimit.js'
|
||||
import { HONEYPOT_FIELD, isHoneypotTripped } from './honeypot.js'
|
||||
import { submitForm } from './submitForm.js'
|
||||
|
||||
type CreateSubmitActionArgs = {
|
||||
/** Optional: IP options (default IPAL_IP_HEADER env / clientIp defaults). */
|
||||
clientIp?: ClientIpOptions
|
||||
getCachedPayload: () => Promise<BasePayload>
|
||||
/**
|
||||
* `headers` from 'next/headers', INJECTED (the plugin never imports next/*,
|
||||
* same pattern as NextResponse in createProxy). Called inside the action only.
|
||||
*/
|
||||
headers: () => Headers | Promise<Headers>
|
||||
/** Honeypot field name. Default HONEYPOT_FIELD. */
|
||||
honeypotField?: string
|
||||
} & Pick<SubmitFormArgs, 'consentFieldName' | 'maxPerMinute' | 'turnstileOnConfigError'>
|
||||
|
||||
export type SubmitActionResult = {
|
||||
field?: string
|
||||
/** Text for the visitor, from Notifications in this locale. */
|
||||
message: string
|
||||
/** Why it failed — for the renderer to mark a field (`field`) or reset Turnstile. */
|
||||
reason?: Exclude<SubmitFormResult, { success: true }>['reason']
|
||||
success: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* The one server action every panel form posts to — honeypot → client IP →
|
||||
* submitForm (rate limit, Turnstile, schema validation, GDPR consent, storage)
|
||||
* → the visitor message from Notifications in the page's locale.
|
||||
*
|
||||
* // src/app/(frontend)/[locale]/actions.ts
|
||||
* 'use server'
|
||||
* import { headers } from 'next/headers'
|
||||
* import { createSubmitAction } from '@intecion/ipal-kit/server'
|
||||
* import { getCachedPayload } from '@/lib/content'
|
||||
* export const sendForm = createSubmitAction({ getCachedPayload, headers })
|
||||
*
|
||||
* Signature matches the ipal-form FormRenderer: `sendForm(formId, locale, values,
|
||||
* turnstileToken?)` — bind formId and locale in the block (`sendForm.bind(null, id, locale)`).
|
||||
* A tripped honeypot gets a fake success and stores nothing.
|
||||
*/
|
||||
export function createSubmitAction({
|
||||
clientIp: ipOptions,
|
||||
consentFieldName,
|
||||
getCachedPayload,
|
||||
headers,
|
||||
honeypotField = HONEYPOT_FIELD,
|
||||
maxPerMinute,
|
||||
turnstileOnConfigError,
|
||||
}: CreateSubmitActionArgs) {
|
||||
return async function sendForm(
|
||||
formId: string,
|
||||
locale: string,
|
||||
values: Record<string, unknown>,
|
||||
turnstileToken?: string,
|
||||
): Promise<SubmitActionResult> {
|
||||
const payload = await getCachedPayload()
|
||||
const texts = (await getNotificationTexts({ locale, payload })).form
|
||||
const data = values && typeof values === 'object' ? values : {}
|
||||
if (isHoneypotTripped(data, honeypotField)) {return { message: texts.success, success: true }}
|
||||
const { [honeypotField]: _honeypot, ...fields } = data
|
||||
|
||||
const ip = clientIp(await headers(), ipOptions) || undefined
|
||||
const result = await submitForm({
|
||||
consentFieldName,
|
||||
data: fields,
|
||||
formId: String(formId),
|
||||
ip,
|
||||
maxPerMinute,
|
||||
payload,
|
||||
turnstileOnConfigError,
|
||||
turnstileToken: typeof turnstileToken === 'string' ? turnstileToken.trim() || undefined : undefined,
|
||||
})
|
||||
const message = resolveFormMessage(result, texts)
|
||||
if (result.success) {return { message, success: true }}
|
||||
return {
|
||||
message,
|
||||
reason: result.reason,
|
||||
success: false,
|
||||
...('field' in result && result.field ? { field: result.field } : {}),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user