import type { GetStaticProps, NextPage } from 'next' import { format, parseISO } from 'date-fns'; import Link from 'next/link'; import { Layout } from '../components/index' import { PostType } from '../types/post'; import { getAllPosts } from '../lib/api'; type IndexProps = { posts: PostType[]; }; export const Home = ({ posts }: IndexProps): JSX.Element => { return (

Красников Павел

Робототехника, программирование

{posts.map((post) => (

{format(parseISO(post.date), 'MMMM dd, yyyy')}

{post.title}

{post.description}

Подробнее...

))}
) } export const getStaticProps: GetStaticProps = async () => { const posts = getAllPosts(['date', 'description', 'slug', 'title']); return { props: { posts }, }; }; export default Home