Skip to content

Commit

Permalink
feat(contentlayer): create Project definition
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed Jul 14, 2023
1 parent 73f36ad commit 310186d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
40 changes: 40 additions & 0 deletions content/definitions/Project.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { defineDocumentType } from 'contentlayer/source-files'

export const Project = defineDocumentType(() => ({
name: 'Project',
contentType: 'mdx',
filePathPattern: 'projects/*.mdx',
fields: {
title: {
type: 'string',
required: true
},
description: {
type: 'string',
required: true
},
image: {
type: 'string',
required: true
},
core_techs: {
type: 'list',
of: { type: 'string' },
required: true
},
tags: {
type: 'list',
of: { type: 'string' },
required: true
},
repository: {
type: 'string'
},
files: {
type: 'string'
},
website: {
type: 'string'
}
}
}))
3 changes: 2 additions & 1 deletion contentlayer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { spawn } from 'node:child_process'
import { makeSource } from 'contentlayer/source-remote-files'

import { Post } from './content/definitions/Post'
import { Project } from './content/definitions/Project'
import { remarkPlugins, rehypePlugins } from './content/plugin'
import { POST_SOURCES } from './content/postsSources'

Expand Down Expand Up @@ -73,7 +74,7 @@ const runBashCommand = (command: string) =>
export default makeSource({
syncFiles: syncContentFromGit,
contentDirPath: 'content',
documentTypes: [Post],
documentTypes: [Post, Project],
disableImportAliasWarning: true,
mdx: {
remarkPlugins,
Expand Down

0 comments on commit 310186d

Please sign in to comment.