import Link from "next/link";
import ReactMarkdown from "react-markdown";
function reformatDate(fullDate) {
const date = new Date(fullDate);
return date.toDateString().slice(4);
}
function truncateSummary(content) {
return content.slice(0, 200).trimEnd() + "...";
}
const BlogList = ({ posts }) => {
return (
<>
{posts.length > 1 &&
posts
// Filter drafts
.filter((post) => !post.slug.startsWith("_"))
// Ternary operator is used to fix chromium sorting
// See: https://stackoverflow.com/a/36507611
.sort((a, b) => (a.frontmatter.date < b.frontmatter.date ? 1 : -1))
.map((post) => (
-
{post.frontmatter.title}
{reformatDate(post.frontmatter.date)}
))}
>
);
};
export default BlogList;