import Link from 'next/link'; import React from 'react'; import Layout from '../../components/layout'; import prettyDatePrint from '../../util/pretty-date'; import { getPostsMeta, PostMeta } from '../../util/slug'; function HomePage(props: {postsMeta: PostMeta[]}) { props.postsMeta.sort((x: any, y: any) => { return (x as any).title.localeCompare((y as any).title) }); // todo: create a table-like user interface return ( <>
Post Name Created on Last Updated
{props.postsMeta.map((post: any) => { return
{post.title} {prettyDatePrint(new Date(post.created_at))} {post.last_updated ? {prettyDatePrint(new Date(post.last_updated))} : ''}
})}
) } export async function getStaticProps() { return { props: { postsMeta: getPostsMeta() } }; } export default HomePage;