[components/MDX][s]: removed dates from meta prop

This commit is contained in:
olayway 2022-06-07 13:00:59 +02:00
parent 89d1c58f97
commit 1ae7095d69
2 changed files with 6 additions and 14 deletions

View File

@ -5,9 +5,9 @@ import { YOUTUBE_REGEX } from "../lib/constants";
import siteConfig from "../config/siteConfig"; import siteConfig from "../config/siteConfig";
import MdxContent from "./MdxContent"; import MdxContent from "./MdxContent";
export default function MdxPage({ body, frontMatter }) { export default function MdxPage({ body, meta }) {
const { title, description, date, keywords, youtube, podcast, image, _raw } = const { title, description, date, keywords, youtube, podcast, image, _raw } =
frontMatter; meta;
let youtubeThumnbnail; let youtubeThumnbnail;

View File

@ -1,18 +1,10 @@
import { allOtherPages } from 'contentlayer/generated'; import { allOtherPages } from "contentlayer/generated";
import MdxPage from '../components/MDX'; import MdxPage from "../components/MDX";
import siteConfig from "../config/siteConfig" import siteConfig from "../config/siteConfig";
export default function Page({ body, ...meta }) { export default function Page({ body, ...meta }) {
const frontMatter = { return <MdxPage body={body} meta={meta} />;
...meta,
date: meta.date === "Invalid Date" ? null : meta.date,
created: meta.created === "Invalid Date" ? null : meta.created
}
return (
<MdxPage body={body} frontMatter={frontMatter} />
);
} }
export const getStaticProps = async ({ params }) => { export const getStaticProps = async ({ params }) => {