post sorting and date fixes
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
---
|
||||
import { formatInTimeZone } from "date-fns-tz";
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
import FormattedDate from "@components/FormattedDate.astro";
|
||||
|
||||
const posts = await Astro.glob("./posts/*.md");
|
||||
posts.sort(
|
||||
(a, b) =>
|
||||
Date.parse(b.frontmatter.pubDate) - Date.parse(a.frontmatter.pubDate)
|
||||
);
|
||||
---
|
||||
|
||||
<Layout title="Blog Archive">
|
||||
@@ -10,11 +15,7 @@ const posts = await Astro.glob("./posts/*.md");
|
||||
posts.map((post) => (
|
||||
<div>
|
||||
<a href={post.url}>{post.frontmatter.title}</a> -{" "}
|
||||
{formatInTimeZone(
|
||||
new Date(post.frontmatter.pubDate),
|
||||
"America/New_York",
|
||||
"MMM do, y"
|
||||
)}
|
||||
<FormattedDate date={post.frontmatter.pubDate} />
|
||||
</div>
|
||||
))
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
layout: ../../layouts/BlogPost.astro
|
||||
title: "My Favorite Little Apps"
|
||||
pubDate: 2022-11-28
|
||||
title: "Getting Out of Your Comfort Zone"
|
||||
pubDate: 2022-12-10
|
||||
---
|
||||
|
||||
When it comes to frameworks, I’ve been firmly stuck in the React–and React-adjacent–world. Basically, my “coding comfort zone” has been vanilla JavaScript, React, and Next.js. The world of web development is much broader than that, but I’m going to be honest, I was a little scared to branch out.
|
||||
|
||||
Reference in New Issue
Block a user