All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🧪 QA (push) Successful in 1m44s
Build & Deploy / 🏗️ Build (push) Successful in 3m55s
Build & Deploy / 🚀 Deploy (push) Successful in 19s
Build & Deploy / 🧪 Post-Deploy Verification (push) Successful in 33m41s
Build & Deploy / ⚡ Performance & Accessibility (push) Successful in 8m15s
Build & Deploy / 🔔 Notify (push) Successful in 2s
91 lines
2.0 KiB
TypeScript
91 lines
2.0 KiB
TypeScript
import { CollectionConfig } from 'payload';
|
|
import { lexicalEditor, BlocksFeature } from '@payloadcms/richtext-lexical';
|
|
import { payloadBlocks } from '../blocks/allBlocks';
|
|
|
|
export const Pages: CollectionConfig = {
|
|
slug: 'pages',
|
|
admin: {
|
|
useAsTitle: 'title',
|
|
defaultColumns: ['title', 'slug', 'layout', '_status', 'updatedAt'],
|
|
},
|
|
versions: {
|
|
drafts: true,
|
|
},
|
|
access: {
|
|
read: ({ req: { user } }) => {
|
|
if (process.env.NODE_ENV === 'development' || process.env.TARGET === 'staging') {
|
|
return true;
|
|
}
|
|
if (user) {
|
|
return true;
|
|
}
|
|
return {
|
|
_status: {
|
|
equals: 'published',
|
|
},
|
|
};
|
|
},
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'title',
|
|
type: 'text',
|
|
required: true,
|
|
localized: true,
|
|
},
|
|
{
|
|
name: 'slug',
|
|
type: 'text',
|
|
required: true,
|
|
localized: true,
|
|
admin: {
|
|
position: 'sidebar',
|
|
description: 'The URL slug for this locale (e.g. "impressum" for DE, "imprint" for EN).',
|
|
},
|
|
},
|
|
{
|
|
name: 'layout',
|
|
type: 'select',
|
|
defaultValue: 'default',
|
|
options: [
|
|
{ label: 'Default (Article)', value: 'default' },
|
|
{ label: 'Full Bleed (Blocks Only)', value: 'fullBleed' },
|
|
],
|
|
admin: {
|
|
position: 'sidebar',
|
|
description: 'Full Bleed pages render blocks edge-to-edge without a generic hero wrapper.',
|
|
},
|
|
},
|
|
{
|
|
name: 'excerpt',
|
|
type: 'textarea',
|
|
localized: true,
|
|
admin: {
|
|
position: 'sidebar',
|
|
},
|
|
},
|
|
{
|
|
name: 'featuredImage',
|
|
type: 'upload',
|
|
relationTo: 'media',
|
|
admin: {
|
|
position: 'sidebar',
|
|
},
|
|
},
|
|
{
|
|
name: 'content',
|
|
type: 'richText',
|
|
localized: true,
|
|
editor: lexicalEditor({
|
|
features: ({ defaultFeatures }) => [
|
|
...defaultFeatures,
|
|
BlocksFeature({
|
|
blocks: payloadBlocks,
|
|
}),
|
|
],
|
|
}),
|
|
required: true,
|
|
},
|
|
],
|
|
};
|