post sorting and date fixes

This commit is contained in:
2023-01-19 19:02:56 -05:00
parent bcf590e1e2
commit cefcebed6f
5 changed files with 27 additions and 10 deletions
+5 -1
View File
@@ -5,11 +5,15 @@ import Layout from "@layouts/Layout.astro";
import BlogHeader from "@components/BlogHeader.astro";
const posts = await Astro.glob("./posts/*.md");
posts.sort(
(a, b) =>
Date.parse(b.frontmatter.pubDate) - Date.parse(a.frontmatter.pubDate)
);
---
<Layout title="Home">
{
posts.map((post) => (
posts.slice(0, 5).map((post) => (
<article class="post-preview">
<div>
<BlogHeader