diff --git a/src/collections/BlogCategories.ts b/src/collections/BlogCategories.ts index 98f8431..21cabf2 100644 --- a/src/collections/BlogCategories.ts +++ b/src/collections/BlogCategories.ts @@ -17,12 +17,23 @@ export const BlogCategories: CollectionConfig = { position: "sidebar", }, hooks: { - beforeValidate: [formatSlug("title")], + beforeValidate: [formatSlug("name")], }, }, + { + name: "parent_category", + label: "Parent Category", + type: "relationship", + relationTo: "blogCategories", + }, + { + name: "description", + type: "textarea", + }, ], admin: { hideAPIURL: true, group: "Blogs", + useAsTitle: "name", }, }; diff --git a/src/collections/BlogTags.tsx b/src/collections/BlogTags.tsx index c337fd5..04256cc 100644 --- a/src/collections/BlogTags.tsx +++ b/src/collections/BlogTags.tsx @@ -17,7 +17,7 @@ export const BlogTags: CollectionConfig = { position: "sidebar", }, hooks: { - beforeValidate: [formatSlug("title")], + beforeValidate: [formatSlug("name")], }, }, { diff --git a/src/payload-types.ts b/src/payload-types.ts index 89b6426..537a842 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -204,6 +204,8 @@ export interface BlogCategory { id: number; name: string; slug?: string | null; + parent_category?: (number | null) | BlogCategory; + description?: string | null; updatedAt: string; createdAt: string; } @@ -725,6 +727,8 @@ export interface TeamsSelect { export interface BlogCategoriesSelect { name?: T; slug?: T; + parent_category?: T; + description?: T; updatedAt?: T; createdAt?: T; }