frontmatter setup
This commit is contained in:
parent
575c18f1ab
commit
e4019fba59
|
|
@ -1,19 +1,44 @@
|
|||
import { defineDocumentType, makeSource } from 'contentlayer/source-files'
|
||||
import { defineDocumentType, defineNestedType, makeSource } from 'contentlayer/source-files'
|
||||
// import readingTime from 'reading-time'
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import remarkGfm from 'remark-gfm'
|
||||
import rehypeSlug from 'rehype-slug'
|
||||
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
|
||||
import wikiLinkPlugin from "remark-wiki-link-plus"
|
||||
|
||||
const ObsidianAliases = defineNestedType(() => ({
|
||||
name: 'Obsidian',
|
||||
filePathPattern: '**/*.md*',
|
||||
fields: {
|
||||
title: { type: 'string', required: true }
|
||||
}
|
||||
}))
|
||||
|
||||
const OtherPage = defineDocumentType(() => ({
|
||||
name: 'OtherPage',
|
||||
filePathPattern: '**/*.md*',
|
||||
contentType: 'mdx',
|
||||
fields: {
|
||||
title: { type: 'string', required: false },
|
||||
date: { type: 'string', required: false },
|
||||
authors: { type: 'string', required: false },
|
||||
description: { type: 'string', required: false },
|
||||
title: { type: 'string' },
|
||||
date: { type: "date", description: "This will be the publication date" },
|
||||
image: { type: "string" },
|
||||
description: { type: 'string' },
|
||||
youtube: { type: "string" },
|
||||
podcast: { type: "string" },
|
||||
featured: { type: "boolean", default: false },
|
||||
created: { type: "date", description: "The date this page was created (For internal use)" },
|
||||
aliases: { type: 'reference', of: ObsidianAliases }
|
||||
},
|
||||
computedFields: {
|
||||
date: {
|
||||
type: "date",
|
||||
resolve: (doc) => new Date(doc.date).toLocaleDateString('en-US', {
|
||||
weekday: "long", year: "numeric", month: "long", day: "numeric"
|
||||
})
|
||||
},
|
||||
created: {
|
||||
type: "date",
|
||||
resolve: (doc) => new Date(doc.created).toLocaleDateString('en-US')
|
||||
},
|
||||
}
|
||||
}));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue