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:
@@ -2,7 +2,7 @@ import type { BasePayload } from 'payload'
|
||||
|
||||
import type { ContentOption, ResolvedRoute } from '../content/index.js'
|
||||
import type { I18nConfig } from '../i18n/index.js'
|
||||
import type { PageMetadata } from './buildMetadata.js'
|
||||
import type { OgImage, PageMetadata } from './buildMetadata.js'
|
||||
import type { SeoMeta } from './types.js'
|
||||
|
||||
import { resolveRoute } from '../content/index.js'
|
||||
@@ -54,21 +54,33 @@ type PageMetadataContext = {
|
||||
}
|
||||
|
||||
type DocShape = {
|
||||
createdAt?: string
|
||||
id: number | string
|
||||
meta?: null | SeoMeta
|
||||
/** Top-level noindex checkbox (buildNoindexField) — the field that persists. */
|
||||
noindex?: boolean | null
|
||||
publishedAt?: null | string
|
||||
/** The document's own title (page name), used as the fallback page title. */
|
||||
title?: null | string
|
||||
updatedAt?: string
|
||||
}
|
||||
|
||||
/** plugin-seo stores the OG image as an upload relationship. */
|
||||
function resolveOgImage(doc: DocShape): null | string {
|
||||
const image = (doc.meta as { image?: unknown } | null | undefined)?.image
|
||||
if (image && typeof image === 'object' && 'url' in image) {
|
||||
return (image as { url: string }).url ?? null
|
||||
/** An upload relationship (populated) → OG image with its size and alt. */
|
||||
function toOgImage(image: unknown): null | OgImage {
|
||||
if (!image || typeof image !== 'object') {return null}
|
||||
const m = image as { alt?: unknown; height?: unknown; url?: unknown; width?: unknown }
|
||||
if (typeof m.url !== 'string' || !m.url) {return null}
|
||||
return {
|
||||
url: m.url,
|
||||
...(typeof m.width === 'number' ? { width: m.width } : {}),
|
||||
...(typeof m.height === 'number' ? { height: m.height } : {}),
|
||||
...(typeof m.alt === 'string' && m.alt ? { alt: m.alt } : {}),
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/** plugin-seo stores the OG image on the meta group; Site Settings has the fallback. */
|
||||
function resolveOgImage(doc: DocShape, fallback: unknown): null | OgImage {
|
||||
return toOgImage((doc.meta as { image?: unknown } | null | undefined)?.image) ?? toOgImage(fallback)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,7 +190,10 @@ export function createPageMetadata(args: CreatePageMetadataArgs) {
|
||||
|
||||
return buildMetadata({
|
||||
...base,
|
||||
imageUrl: resolveOgImage(doc),
|
||||
...(route.type === 'entry'
|
||||
? { article: { modifiedTime: doc.updatedAt, publishedTime: doc.publishedAt ?? doc.createdAt } }
|
||||
: {}),
|
||||
image: resolveOgImage(doc, site.defaultShareImage),
|
||||
meta: doc.meta,
|
||||
noindex: doc.noindex,
|
||||
pageTitle: doc.title,
|
||||
|
||||
Reference in New Issue
Block a user