import { GetServerSideProps } from "next"; import { MainLayout } from "../../layouts/MainLayout"; import { BlogPost, getAllFilesFrontMatter } from "../../utils/markdown"; import { FrontMatter } from "../../types/types"; import Link from "next/link"; interface BasicBlogProps extends FrontMatter { title: string; description: string; date: string; author: string; } const BlogCard = ({ blog, slug }: { blog: BasicBlogProps; slug: string }) => { const format = (date: string) => { const [day, month, year] = date.split("."); const d = new Date(`${year}-${month}-${day}`); return d.toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric", }); }; return (
{format(blog.date)}

{blog.title}

{blog.description}

); }; const Blog = ({ posts }: { posts: BlogPost[] }) => { return (

Blog

{posts.map((post, index) => ( ))}
); }; export const getServerSideProps: GetServerSideProps = async () => { const posts = getAllFilesFrontMatter(); return { props: { posts, }, }; }; export default Blog;