29 lines
559 B
TypeScript
29 lines
559 B
TypeScript
|
import formatSlug from "@/utils/formatSlug";
|
||
|
import type { CollectionConfig } from "payload";
|
||
|
|
||
|
export const BlogCategories: CollectionConfig = {
|
||
|
slug: "blogCategories",
|
||
|
labels: { plural: "Categories", singular: "Category" },
|
||
|
fields: [
|
||
|
{
|
||
|
name: "name",
|
||
|
type: "text",
|
||
|
required: true,
|
||
|
},
|
||
|
{
|
||
|
name: "slug",
|
||
|
type: "text",
|
||
|
admin: {
|
||
|
position: "sidebar",
|
||
|
},
|
||
|
hooks: {
|
||
|
beforeValidate: [formatSlug("title")],
|
||
|
},
|
||
|
},
|
||
|
],
|
||
|
admin: {
|
||
|
hideAPIURL: true,
|
||
|
group: "Blogs",
|
||
|
},
|
||
|
};
|