44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { getPayload } from 'payload'
|
|
import configPromise from '../src/payload.config'
|
|
|
|
async function run() {
|
|
const payload = await getPayload({ config: configPromise })
|
|
|
|
const home = await payload.find({ collection: 'pages', where: { slug: { equals: 'home' } }, locale: 'pl' })
|
|
if (home.docs[0] && home.docs[0].layout) {
|
|
const enLayout = home.docs[0].layout.map(block => {
|
|
// Remove id so Payload generates a new one
|
|
const { id, blockName, ...rest } = block as any
|
|
if (rest.blockType === 'hero') {
|
|
return {
|
|
...rest,
|
|
title: 'Your Trusted Accounting Office in Germany',
|
|
titleAccent: 'We speak English and Polish',
|
|
subtitle: 'Professional bookkeeping, tax settlements, and business consulting for companies in Germany.',
|
|
primaryCta: 'Contact Us',
|
|
secondaryCta: { text: 'Our Services', url: '/uslugi' }
|
|
}
|
|
}
|
|
return rest
|
|
})
|
|
|
|
try {
|
|
await payload.update({
|
|
collection: 'pages',
|
|
id: home.docs[0].id,
|
|
locale: 'en',
|
|
data: {
|
|
title: 'Accounting Services in Germany',
|
|
layout: enLayout
|
|
}
|
|
})
|
|
console.log("Successfully fixed EN home page")
|
|
} catch (e) {
|
|
console.error("Error fixing EN home page", e)
|
|
}
|
|
}
|
|
|
|
process.exit(0)
|
|
}
|
|
run().catch(console.error)
|