63 lines
1.2 KiB
TypeScript
63 lines
1.2 KiB
TypeScript
|
import { BeforeFooterBlock } from "@/blocks/BeforeFooter";
|
||
|
import { ContentBlock } from "@/blocks/Content";
|
||
|
import formatSlug from "@/utils/formatSlug";
|
||
|
import { CollectionConfig } from "payload";
|
||
|
|
||
|
export const Pages: CollectionConfig = {
|
||
|
slug: "pages",
|
||
|
fields: [
|
||
|
{
|
||
|
name: "title",
|
||
|
label: "Page Title",
|
||
|
type: "text",
|
||
|
required: true,
|
||
|
},
|
||
|
{
|
||
|
name: "hero_img",
|
||
|
label: "Hero Image",
|
||
|
type: "upload",
|
||
|
relationTo: "media",
|
||
|
},
|
||
|
{
|
||
|
name: "slug",
|
||
|
label: "Page Slug",
|
||
|
type: "text",
|
||
|
admin: {
|
||
|
position: "sidebar",
|
||
|
},
|
||
|
hooks: {
|
||
|
beforeValidate: [formatSlug("title")],
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
name: "layout",
|
||
|
label: "Page Layout",
|
||
|
type: "blocks",
|
||
|
minRows: 1,
|
||
|
blocks: [ContentBlock, BeforeFooterBlock],
|
||
|
},
|
||
|
{
|
||
|
name: "meta",
|
||
|
label: "Page Meta",
|
||
|
type: "group",
|
||
|
fields: [
|
||
|
{
|
||
|
name: "title",
|
||
|
label: "Title",
|
||
|
type: "text",
|
||
|
},
|
||
|
{
|
||
|
name: "description",
|
||
|
label: "Description",
|
||
|
type: "textarea",
|
||
|
},
|
||
|
{
|
||
|
name: "keywords",
|
||
|
label: "Keywords",
|
||
|
type: "text",
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
],
|
||
|
};
|