From 1361daa2498a1516c6063ce77409626b96894f60 Mon Sep 17 00:00:00 2001 From: Marten de Groot Date: Tue, 24 Dec 2024 14:33:26 +0100 Subject: [PATCH] Added FAQ Collection --- cms/collections.ts | 3 +- layouts/faq/collection.ts | 144 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 layouts/faq/collection.ts diff --git a/cms/collections.ts b/cms/collections.ts index 0d8efbb1..47bf1e0c 100644 --- a/cms/collections.ts +++ b/cms/collections.ts @@ -1,3 +1,4 @@ +import { DynamicFaqCollection, FaqCollection } from '../layouts/faq/collection'; import { Collection as ArticlesCollection } from '../layouts/newsroom/collection'; -export default [ArticlesCollection]; +export default [ArticlesCollection, DynamicFaqCollection, FaqCollection]; diff --git a/layouts/faq/collection.ts b/layouts/faq/collection.ts new file mode 100644 index 00000000..d8c6ca42 --- /dev/null +++ b/layouts/faq/collection.ts @@ -0,0 +1,144 @@ +export const FaqCollection = { + name: 'faq', + label: 'FAQ', + files: [ + { + label: 'Fixed FAQ', + name: 'fixedfaq', + file: 'content/faq/_index.en.md', + slug: '_index', + create: false, + fields: [ + { + label: 'Title', + name: 'title', + widget: 'string', + default: 'faq', + i18n: true, + }, + { + label: 'Opener', + name: 'opener', + widget: 'string', + i18n: true, + }, + { + label: 'Intro', + name: 'intro', + widget: 'text', + i18n: true, + }, + { + label: 'FAQ groups', + name: 'faqgroups', + widget: 'list', + i18n: true, + fields: [ + { + label: 'heading', + name: 'heading', + widget: 'string', + i18n: true, + }, + { + label: 'FAQs', + name: 'faqs', + widget: 'list', + i18n: true, + fields: [ + { + label: 'Title', + name: 'title', + widget: 'string', + i18n: true, + }, + { + label: 'Description', + name: 'description', + widget: 'markdown', + i18n: true, + }, + ], + }, + ], + }, + ], + }, + ], +}; + +export const DynamicFaqCollection = { + name: 'dynamicfaq', + label: 'Dynamic FAQ', + folder: 'content/faq', + create: true, + slug: '{{slug}}', + i18n: true, + fields: [ + { + label: 'Title', + name: 'title', + widget: 'string', + default: 'faq', + i18n: true, + }, + { + label: 'Opener', + name: 'opener', + widget: 'string', + i18n: true, + }, + { + label: 'Intro', + name: 'intro', + widget: 'text', + i18n: true, + }, + { + label: 'Button text', + name: 'button_text', + widget: 'string', + i18n: true, + }, + { + label: 'Button url', + name: 'button_url', + widget: 'string', + i18n: true, + }, + { + label: 'FAQ groups', + name: 'faqgroups', + widget: 'list', + i18n: true, + fields: [ + { + label: 'heading', + name: 'heading', + widget: 'string', + i18n: true, + }, + { + label: 'FAQs', + name: 'faqs', + widget: 'list', + i18n: true, + fields: [ + { + label: 'Title', + name: 'title', + widget: 'string', + i18n: true, + }, + { + label: 'Description', + name: 'description', + widget: 'markdown', + i18n: true, + }, + ], + }, + ], + }, + ], +};