refactor: rename published to date
This commit is contained in:
@@ -49,10 +49,10 @@ export const meta: MetaFunction<typeof loader> = ({ data }) => {
|
||||
export default function Post() {
|
||||
const {
|
||||
code,
|
||||
frontmatter: { title, published },
|
||||
frontmatter: { title, date },
|
||||
file,
|
||||
} = useLoaderData<typeof loader>();
|
||||
const formattedDate = useFormattedDate(published);
|
||||
const formattedDate = useFormattedDate(date);
|
||||
const MdxComponent = React.useMemo(() => getMDXComponent(code), [code]);
|
||||
|
||||
return (
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { remarkCodeHike } from "@code-hike/mdx";
|
||||
import { bundleMDX } from "mdx-bundler";
|
||||
import { readdir, readFile } from "node:fs/promises";
|
||||
import { readFile, readdir } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
type FrontMatter = {
|
||||
title: string;
|
||||
description: string;
|
||||
published: Date;
|
||||
date: Date;
|
||||
isFeatured: boolean;
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ export const findPosts = async () => {
|
||||
posts.push({
|
||||
...frontmatter,
|
||||
filename: file.replace(".mdx", ""),
|
||||
published: frontmatter.published.toISOString(),
|
||||
published: frontmatter.date.toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user