feat(marketing-pages): add pages collection + siteSettings global
This commit is contained in:
@@ -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,
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -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",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
2
packages/marketing-pages/src/integrations/cms/index.ts
Normal file
2
packages/marketing-pages/src/integrations/cms/index.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export { pages } from "./collections/pages";
|
||||||
|
export { siteSettings } from "./globals/site-settings";
|
||||||
Reference in New Issue
Block a user