You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportconstPost=defineDocumentType(()=>({name: 'Post',filePathPattern: `**/*.md`,fields: {title: {type: 'string',description: 'The title of the post',required: true,},date: {type: 'date',description: 'The date of the post',required: true,},},computedFields: {url: {type: 'string',resolve: (post)=>`/posts/${post._raw.flattenedPath}`,},},}))exportdefaultmakeSource({contentDirPath: 'posts',documentTypes: [Post],})
If you don't create a Markdown file on the folder, the _index.json file won't be created, which will generate the following error when building:
Failed to compile.
.contentlayer/generated/index.mjs:10:0
Module not found: Can't resolve './Post/_index.json'
Although it's not a big issue, Contentlayer should generate the file with an empty array even if there's no content, so there are no errors when building.
Activity
schickling commentedon May 11, 2022
This should be addressed with the
0.2.5release. 🎉