From ceb9d939ba51cbbc15243c2ee59fd79c30c10d21 Mon Sep 17 00:00:00 2001 From: Oliver Barnwell Date: Fri, 17 May 2024 17:03:05 +0100 Subject: [PATCH] add page as a document type --- contentlayer.config.ts | 13 ++++++++++++- package.json | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/contentlayer.config.ts b/contentlayer.config.ts index 74729f825..97efbdd67 100644 --- a/contentlayer.config.ts +++ b/contentlayer.config.ts @@ -15,7 +15,18 @@ export const Post = defineDocumentType(() => ({ }, }, })); + +export const Page = defineDocumentType(() => ({ + name: 'Page', + filePathPattern: `pages/**/*.md`, + fields: { + title: { type: 'string', required: true }, + date: { type: 'date', required: true }, + author: { type: 'string', required: true }, + }, +})); + export default makeSource({ contentDirPath: 'content', - documentTypes: [Post], + documentTypes: [Post, Page], }); diff --git a/package.json b/package.json index eb5baa81f..040179664 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "os": false }, "scripts": { - "build": "next build", + "build": "contentlayer build && next build", "dev": "next dev", "start": "next start", "lint": "next lint",