From a748ce64c2d887f66781104558848e1c28855c22 Mon Sep 17 00:00:00 2001 From: Oliver Barnwell Date: Mon, 27 May 2024 18:43:00 +0100 Subject: [PATCH] setup frontmatter and collection for mdx pages --- content/pages/{home.md => home.mdx} | 0 contentlayer.config.ts | 4 ++-- public/admin/config.yml | 17 +++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) rename content/pages/{home.md => home.mdx} (100%) diff --git a/content/pages/home.md b/content/pages/home.mdx similarity index 100% rename from content/pages/home.md rename to content/pages/home.mdx diff --git a/contentlayer.config.ts b/contentlayer.config.ts index fbb4832fa..c6c3dd3dd 100644 --- a/contentlayer.config.ts +++ b/contentlayer.config.ts @@ -18,8 +18,8 @@ export const Post = defineDocumentType(() => ({ export const Page = defineDocumentType(() => ({ name: 'Page', - filePathPattern: `pages/**/*.md`, - contentType: 'markdown', + filePathPattern: `pages/**/*.mdx`, + contentType: 'mdx', fields: { title: { type: 'string', required: true }, date: { type: 'date', required: true }, diff --git a/public/admin/config.yml b/public/admin/config.yml index 5a4a1e62e..da4f86ab9 100644 --- a/public/admin/config.yml +++ b/public/admin/config.yml @@ -13,11 +13,12 @@ public_folder: /images/uploads collections: - name: "pages" label: "Pages" - files: - - label: "Home" - name: "home" - file: "content/pages/home.md" - fields: - - { label: "Title", name: "title", widget: "string"} - - { label: "Publish Date", name: "date", widget: "datetime" } - - { label: "Author", name: "author", widget: "string" } + label_singular: 'Page' + folder: content/pages + extension: "mdx" + format: "frontmatter" + fields: + - { label: "Title", name: "title", widget: "string"} + - { label: "Publish Date", name: "date", widget: "datetime" } + - { label: "Author", name: "author", widget: "string" } + - { label: "Body", name: "body", widget: "markdown" }