cms.c2sgmbh/src/collections/Pages.ts
Martin Porwoll 16be4cf553 feat: add FAQ collection and block
- Add FAQs collection with question/answer, categories, and ordering
- Add FAQBlock with collection and inline source modes
- Support multiple layouts: accordion, grid, list, two-column
- Schema.org FAQPage structured data support for SEO
- Multi-tenant enabled via plugin configuration
- Update documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 05:34:41 +00:00

143 lines
2.8 KiB
TypeScript

import type { CollectionConfig } from 'payload'
import {
HeroBlock,
TextBlock,
ImageTextBlock,
CardGridBlock,
QuoteBlock,
CTABlock,
ContactFormBlock,
TimelineBlock,
DividerBlock,
VideoBlock,
// Neue Blocks
PostsListBlock,
TestimonialsBlock,
NewsletterBlock,
ProcessStepsBlock,
FAQBlock,
} from '../blocks'
export const Pages: CollectionConfig = {
slug: 'pages',
admin: {
useAsTitle: 'title',
defaultColumns: ['title', 'slug', 'status', 'updatedAt'],
},
access: {
read: ({ req }) => {
// Eingeloggte User sehen alles
if (req.user) return true
// Öffentlich: nur veröffentlichte Seiten
return {
status: {
equals: 'published',
},
}
},
create: ({ req }) => !!req.user,
update: ({ req }) => !!req.user,
delete: ({ req }) => !!req.user,
},
fields: [
{
name: 'title',
type: 'text',
required: true,
localized: true,
},
{
name: 'slug',
type: 'text',
required: true,
localized: true,
unique: false, // Uniqueness per locale handled by index
admin: {
description: 'URL-Pfad (z.B. "ueber-uns" / "about-us")',
},
},
{
name: 'hero',
type: 'group',
fields: [
{
name: 'image',
type: 'upload',
relationTo: 'media',
},
{
name: 'headline',
type: 'text',
localized: true,
},
{
name: 'subline',
type: 'textarea',
localized: true,
},
],
},
{
name: 'layout',
type: 'blocks',
label: 'Seiteninhalt',
blocks: [
// Bestehende Blocks
HeroBlock,
TextBlock,
ImageTextBlock,
CardGridBlock,
QuoteBlock,
CTABlock,
ContactFormBlock,
TimelineBlock,
DividerBlock,
VideoBlock,
// Neue Blocks
PostsListBlock,
TestimonialsBlock,
NewsletterBlock,
ProcessStepsBlock,
FAQBlock,
],
},
{
name: 'seo',
type: 'group',
label: 'SEO',
fields: [
{
name: 'metaTitle',
type: 'text',
label: 'Meta-Titel',
localized: true,
},
{
name: 'metaDescription',
type: 'textarea',
label: 'Meta-Beschreibung',
localized: true,
},
{
name: 'ogImage',
type: 'upload',
relationTo: 'media',
label: 'Social Media Bild',
},
],
},
{
name: 'status',
type: 'select',
defaultValue: 'draft',
options: [
{ label: 'Entwurf', value: 'draft' },
{ label: 'Veröffentlicht', value: 'published' },
],
},
{
name: 'publishedAt',
type: 'date',
},
],
}