Skip to content

Commit

Permalink
add page as a document type
Browse files Browse the repository at this point in the history
  • Loading branch information
ob6160 committed May 17, 2024
1 parent 993bf30 commit ceb9d93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion contentlayer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"os": false
},
"scripts": {
"build": "next build",
"build": "contentlayer build && next build",
"dev": "next dev",
"start": "next start",
"lint": "next lint",
Expand Down

0 comments on commit ceb9d93

Please sign in to comment.