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:
@@ -6,11 +6,21 @@ import { blocksToMarkdown } from './blocksToMarkdown.js'
|
||||
import { resolveRoute } from './resolveRoute.js'
|
||||
|
||||
type CreateMarkdownRendererArgs = {
|
||||
/**
|
||||
* Absolute origin. With it the frontmatter carries `url:` — the canonical page
|
||||
* address an assistant should cite (instead of the /md/… mirror).
|
||||
*/
|
||||
baseUrl?: string
|
||||
/** Pages collection. Default 'pages'. */
|
||||
collection?: string
|
||||
/**
|
||||
* i18n config — only to know a single-locale site has no /{locale} prefix in
|
||||
* its URLs (for `url:`). Omit on multilingual sites if you like.
|
||||
*/
|
||||
config?: { locales: readonly unknown[] }
|
||||
/** Archive-backed collections, same value as the plugin option (optional). */
|
||||
content?: ContentOption
|
||||
/** Prepend a YAML frontmatter block (title/description/locale). Default true. */
|
||||
/** Prepend a YAML frontmatter block (title, description, url, updated, locale). Default true. */
|
||||
frontmatter?: boolean
|
||||
/** Field holding the block layout. Default 'layout'. */
|
||||
layoutField?: string
|
||||
@@ -31,6 +41,7 @@ type DocShape = {
|
||||
[key: string]: unknown
|
||||
meta?: { description?: null | string } | null
|
||||
title?: null | string
|
||||
updatedAt?: string
|
||||
}
|
||||
|
||||
function yamlEscape(v: string): string {
|
||||
@@ -62,7 +73,9 @@ function yamlEscape(v: string): string {
|
||||
*/
|
||||
export function createMarkdownRenderer(args: CreateMarkdownRendererArgs = {}) {
|
||||
const {
|
||||
baseUrl,
|
||||
collection = 'pages',
|
||||
config,
|
||||
content,
|
||||
frontmatter = true,
|
||||
layoutField = 'layout',
|
||||
@@ -92,6 +105,11 @@ export function createMarkdownRenderer(args: CreateMarkdownRendererArgs = {}) {
|
||||
const fm = ['---', `locale: ${locale}`]
|
||||
if (title) {fm.push(`title: ${yamlEscape(title)}`)}
|
||||
if (description) {fm.push(`description: ${yamlEscape(description)}`)}
|
||||
if (baseUrl) {
|
||||
const segments = config?.locales.length === 1 ? (slug ?? []) : [locale, ...(slug ?? [])]
|
||||
fm.push(`url: ${baseUrl.replace(/\/$/, '')}/${segments.join('/')}`.replace(/\/$/, ''))
|
||||
}
|
||||
if (typeof doc.updatedAt === 'string') {fm.push(`updated: ${doc.updatedAt.slice(0, 10)}`)}
|
||||
fm.push('---')
|
||||
parts.push(fm.join('\n'))
|
||||
}
|
||||
@@ -121,3 +139,39 @@ export function markdownResponse(md: null | string): Response {
|
||||
status: 200,
|
||||
})
|
||||
}
|
||||
|
||||
type MarkdownRouteContext = { params: Promise<{ locale: string; slug?: string[] }> }
|
||||
|
||||
/**
|
||||
* The whole Markdown route in one call — same options as createMarkdownRenderer
|
||||
* plus `getCachedPayload`:
|
||||
*
|
||||
* // src/app/md/[locale]/[[...slug]]/route.ts
|
||||
* import { createMarkdownRoute } from '@intecion/ipal-kit'
|
||||
* import { getCachedPayload } from '@/lib/content'
|
||||
* import { contentConfig } from '@/content.config'
|
||||
* import { i18nConfig } from '@/i18n.config'
|
||||
* export const dynamic = 'force-dynamic'
|
||||
* export const { GET } = createMarkdownRoute({ getCachedPayload, content: contentConfig,
|
||||
* config: i18nConfig, baseUrl: process.env.NEXT_PUBLIC_SERVER_URL })
|
||||
*
|
||||
* 404 for unknown/unpublished pages; a database error returns a generic 503
|
||||
* (details only in the server log).
|
||||
*/
|
||||
export function createMarkdownRoute(
|
||||
args: { getCachedPayload: () => Promise<BasePayload> } & CreateMarkdownRendererArgs,
|
||||
): { GET: (req: Request, ctx: MarkdownRouteContext) => Promise<Response> } {
|
||||
const { getCachedPayload, ...rendererArgs } = args
|
||||
const render = createMarkdownRenderer(rendererArgs)
|
||||
return {
|
||||
GET: async (_req, { params }) => {
|
||||
try {
|
||||
const { slug, locale } = await params
|
||||
return markdownResponse(await render({ slug, locale, payload: await getCachedPayload() }))
|
||||
} catch (err) {
|
||||
console.warn('[ipal] createMarkdownRoute: render failed:', err)
|
||||
return new Response('Service unavailable', { headers: { 'content-type': 'text/plain' }, status: 503 })
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user