From a44142b8758a695e084240b83cfa18bd8453d0e1 Mon Sep 17 00:00:00 2001 From: Danijel Martinek Date: Tue, 5 May 2026 08:31:37 +0200 Subject: [PATCH] feat(marketing-pages): add pages collection + siteSettings global --- .../src/integrations/cms/collections/pages.ts | 75 +++++++++++++++++++ .../integrations/cms/globals/site-settings.ts | 20 +++++ .../src/integrations/cms/index.ts | 2 + 3 files changed, 97 insertions(+) create mode 100644 packages/marketing-pages/src/integrations/cms/collections/pages.ts create mode 100644 packages/marketing-pages/src/integrations/cms/globals/site-settings.ts create mode 100644 packages/marketing-pages/src/integrations/cms/index.ts diff --git a/packages/marketing-pages/src/integrations/cms/collections/pages.ts b/packages/marketing-pages/src/integrations/cms/collections/pages.ts new file mode 100644 index 0000000..8c4f7db --- /dev/null +++ b/packages/marketing-pages/src/integrations/cms/collections/pages.ts @@ -0,0 +1,75 @@ +import type { CollectionConfig } from "payload"; +import { + cta, + seoFields, + slugifyIfMissing, +} from "@repo/core-shared/payload"; + +export const pages: CollectionConfig = { + slug: "pages", + admin: { + useAsTitle: "title", + defaultColumns: ["title", "status", "updatedAt"], + }, + hooks: { + beforeChange: [slugifyIfMissing], + }, + versions: { + drafts: true, + }, + fields: [ + { + name: "title", + type: "text", + required: true, + maxLength: 255, + }, + { + name: "slug", + type: "text", + unique: true, + admin: { + position: "sidebar", + description: "Auto-generated from title if left empty", + }, + }, + { + name: "hero", + type: "group", + fields: [ + { name: "heading", type: "text", required: true }, + { name: "subheading", type: "textarea" }, + { + name: "image", + type: "upload", + relationTo: "media", + }, + ], + }, + { + name: "layout", + type: "blocks", + blocks: [cta], + }, + { + name: "status", + type: "select", + options: [ + { label: "Draft", value: "draft" }, + { label: "Published", value: "published" }, + ], + defaultValue: "draft", + required: true, + admin: { position: "sidebar" }, + }, + { + name: "publishedAt", + type: "date", + admin: { + position: "sidebar", + date: { pickerAppearance: "dayAndTime" }, + }, + }, + seoFields, + ], +}; diff --git a/packages/marketing-pages/src/integrations/cms/globals/site-settings.ts b/packages/marketing-pages/src/integrations/cms/globals/site-settings.ts new file mode 100644 index 0000000..7306cfa --- /dev/null +++ b/packages/marketing-pages/src/integrations/cms/globals/site-settings.ts @@ -0,0 +1,20 @@ +import type { GlobalConfig } from "payload"; + +export const siteSettings: GlobalConfig = { + slug: "site-settings", + admin: { + group: "Settings", + }, + fields: [ + { + name: "siteName", + type: "text", + required: true, + defaultValue: "My App", + }, + { + name: "siteDescription", + type: "textarea", + }, + ], +}; diff --git a/packages/marketing-pages/src/integrations/cms/index.ts b/packages/marketing-pages/src/integrations/cms/index.ts new file mode 100644 index 0000000..41a8df2 --- /dev/null +++ b/packages/marketing-pages/src/integrations/cms/index.ts @@ -0,0 +1,2 @@ +export { pages } from "./collections/pages"; +export { siteSettings } from "./globals/site-settings";