import {GetStaticProps} from 'next' import Head from 'next/head' import {Card} from '@/components/Card' import {SimpleLayout} from '@/components/layouts/SimpleLayout' import {getAllArticles} from '@/lib/getAllArticles' import {formatDate} from '@/lib/formatDate' import {Article} from 'types' function Article({article}: { article: Article }) { return (
{article.title} {formatDate(article.date)}
) } export default function ArticlesIndex({articles}: { articles: Article[] }) { return ( <> Writing - Ryan Freeman
{articles.map((article) => (
))}
) } export const getStaticProps: GetStaticProps = async () => { return { props: { articles: (await getAllArticles()).map(({component, ...meta}) => meta), } } }