feat: manage press fallback labels via payload

This commit is contained in:
syntaxbullet
2026-06-22 12:27:36 +02:00
parent 9ce55217a1
commit 6676610e5e
5 changed files with 142 additions and 29 deletions

View File

@@ -32,8 +32,14 @@ async function main() {
const page = pageResult.docs[0]
if (!page) throw new Error('Press index page not found. Expected spaPath=/presse or slug=presse/press.')
const heroImage = await mediaByFilename(payload, pressIndexContent.hero.imageFilename)
const [heroImage, eventFallbackImage, newsFallbackImage] = await Promise.all([
mediaByFilename(payload, pressIndexContent.hero.imageFilename),
mediaByFilename(payload, pressIndexContent.events.collectionFallbackImageFilename),
mediaByFilename(payload, pressIndexContent.news.collectionFallbackImageFilename),
])
const { imageFilename: _heroFilename, ...heroContent } = pressIndexContent.hero
const { collectionFallbackImageFilename: _eventFallbackFilename, ...eventsContent } = pressIndexContent.events
const { collectionFallbackImageFilename: _newsFallbackFilename, ...newsContent } = pressIndexContent.news
await payload.update({
collection: 'pages',
@@ -47,6 +53,14 @@ async function main() {
...heroContent,
image: heroImage,
},
events: {
...eventsContent,
collectionFallbackImage: eventFallbackImage,
},
news: {
...newsContent,
collectionFallbackImage: newsFallbackImage,
},
},
} as never,
})