diff --git a/site/contentlayer.config.ts b/site/contentlayer.config.ts
index 15e0d31..43cf1e0 100644
--- a/site/contentlayer.config.ts
+++ b/site/contentlayer.config.ts
@@ -5,6 +5,9 @@ import rehypeSlug from 'rehype-slug'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
import wikiLinkPlugin from "remark-wiki-link-plus"
+const isValidDate = dateObject => new Date(dateObject)
+ .toString() !== 'Invalid Date';
+
const ObsidianAliases = defineNestedType(() => ({
name: 'Obsidian',
filePathPattern: '**/*.md*',
@@ -22,6 +25,7 @@ const OtherPage = defineDocumentType(() => ({
date: { type: "date", description: "This will be the publication date" },
image: { type: "string" },
description: { type: 'string' },
+ keywords: { type: "string" },
youtube: { type: "string" },
podcast: { type: "string" },
featured: { type: "boolean", default: false },
@@ -31,13 +35,19 @@ const OtherPage = defineDocumentType(() => ({
computedFields: {
date: {
type: "date",
- resolve: (doc) => new Date(doc.date).toLocaleDateString('en-US', {
- weekday: "long", year: "numeric", month: "long", day: "numeric"
- })
+ resolve: (doc) => {
+ const formattedDate = new Date(doc.date).toLocaleDateString('en-US', {
+ weekday: "long", year: "numeric", month: "long", day: "numeric"
+ })
+ return isValidDate(formattedDate) ? formattedDate : null
+ }
},
created: {
type: "date",
- resolve: (doc) => new Date(doc.created).toLocaleDateString('en-US')
+ resolve: (doc) => {
+ const formattedDate = new Date(doc.created).toLocaleDateString('en-US')
+ return isValidDate(formattedDate) ? formattedDate : null
+ }
},
}
}));
diff --git a/site/pages/[...slug].js b/site/pages/[...slug].js
index 4ec7602..4c51bd9 100644
--- a/site/pages/[...slug].js
+++ b/site/pages/[...slug].js
@@ -1,7 +1,6 @@
import MdxPage from '../components/MDX';
import { allOtherPages } from 'contentlayer/generated';
import { useMDXComponent } from 'next-contentlayer/hooks';
-import siteConfig from "../config/siteConfig"
export default function Page({ body, ...rest }) {
@@ -9,19 +8,12 @@ export default function Page({ body, ...rest }) {
const children = {
Component,
frontmatter: {
- ...rest,
- date: rest.date === "Invalid Date" ? null : rest.date,
- created: rest.created === "Invalid Date" ? null : rest.created
+ ...rest
},
};
-
- // enable editing content only for claims, concepts, and guide for now
- const editUrl = ['claims', 'concepts', 'guide'].includes(rest._raw.sourceFileDir)
- ? siteConfig.repoRoot + siteConfig.repoEditPath + rest._raw.sourceFilePath
- : null
return (
-
+
);
}