Fewer queries per render: resolveRoute and page metadata cached by value, select for slug-only reads, one Site integrations read
Home 43 -> 24 MongoDB queries per render, other pages -36 to -44 %. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f3be77b2bc
commit
1d6108765c
@@ -28,7 +28,7 @@ export const Pages: CollectionConfig = {
|
||||
{ name: 'layout', type: 'blocks', blocks: pageBlocks, minRows: 1 },
|
||||
buildSummaryField(), // aiSummary — GEO (llms.txt, MCP)
|
||||
buildNoindexField(),
|
||||
{ name: 'slugHistory', type: 'array', admin: { components: rowLabel('slug', 'Old address'), readOnly: true }, fields: [{ name: 'slug', type: 'text' }], labels: { plural: 'Old addresses', singular: 'Old address' } },
|
||||
{ name: 'slugHistory', type: 'array', admin: { components: rowLabel('slug', 'Old address'), readOnly: true }, fields: [{ name: 'slug', type: 'text', index: true }], labels: { plural: 'Old addresses', singular: 'Old address' } },
|
||||
],
|
||||
hooks: {
|
||||
afterChange: [revalidate.afterChange],
|
||||
|
||||
@@ -2,9 +2,8 @@ import { faqItemsFromLayout } from '@intecion/ipal-kit/blocks'
|
||||
// @starter:if localBusiness
|
||||
import { buildLocalBusinessJsonLd, createContentHelpers } from '@intecion/ipal-kit'
|
||||
|
||||
import { getPayload } from 'payload'
|
||||
import { contentConfig } from '@/content.config'
|
||||
import { i18nConfig, type Locale } from '@/i18n.config'
|
||||
import { i18nConfig } from '@/i18n.config'
|
||||
// @starter:else
|
||||
//: import { createContentHelpers } from '@intecion/ipal-kit'
|
||||
//:
|
||||
@@ -65,8 +64,9 @@ export const {
|
||||
// @starter:if localBusiness
|
||||
// LocalBusiness from the Company global (replaces the default WebSite + Organization from Site settings)
|
||||
siteJsonLd: async ({ baseUrl, locale }) => {
|
||||
const payload = await getPayload({ config })
|
||||
const company = await payload.findGlobal({ slug: 'company', locale: locale as Locale })
|
||||
// the layout's cached getter: one Company read per request, not two (docs/performance.md → server)
|
||||
const { getCompany } = await import('./globals')
|
||||
const company = await getCompany(locale)
|
||||
return [
|
||||
buildLocalBusinessJsonLd({
|
||||
address: { city: company.address?.city ?? undefined, country: company.address?.country ?? 'PL', postalCode: company.address?.postalCode ?? undefined, street: company.address?.street ?? undefined },
|
||||
|
||||
Reference in New Issue
Block a user