import Link from "next/link"; import date from "../lib/date"; import style from '../styles/recent-posts.module.css'; import PostsInfo from '../public/posts.json'; function RecentPosts() { const posts = Object.entries(PostsInfo); if (!posts.length) return <>; return (
Recent Posts
{posts?.slice(0, 10) .map(([slug, post]: any) => { return
{date.toRelativeDate(new Date(post.otime))}
{post.title}
})}
{ posts.length > 10 &&
More...
}
); } export default RecentPosts;