added dates to posts
This commit is contained in:
@ -2,6 +2,11 @@
|
|||||||
import Navbar from '../components/Navbar.astro'
|
import Navbar from '../components/Navbar.astro'
|
||||||
|
|
||||||
const posts = await Astro.glob('./posts/*.md');
|
const posts = await Astro.glob('./posts/*.md');
|
||||||
|
const sortedPosts = posts.sort((a, b) => {
|
||||||
|
const splitA = a.frontmatter.date.split("/");
|
||||||
|
const splitB = b.frontmatter.date.split("/");
|
||||||
|
return new Date(splitB[1], splitB[0], splitB[2]).getTime() - new Date(splitA[1], splitA[0], splitA[2]).getTime()
|
||||||
|
});
|
||||||
---
|
---
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@ -10,7 +15,7 @@ const posts = await Astro.glob('./posts/*.md');
|
|||||||
<body class="w-full flex flex-col items-center bg-polar-night-400">
|
<body class="w-full flex flex-col items-center bg-polar-night-400">
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<div class="w-full max-w-4xl flex flex-col gap-4 p-4">
|
<div class="w-full max-w-4xl flex flex-col gap-4 p-4">
|
||||||
{posts.map((post) => (
|
{sortedPosts.map((post) => (
|
||||||
<a href={post.url} class="flex flex-col border-frost-400 border-2 text-snow-storm-100 p-4 rounded-lg">
|
<a href={post.url} class="flex flex-col border-frost-400 border-2 text-snow-storm-100 p-4 rounded-lg">
|
||||||
<h1 class="text-2xl">{post.frontmatter.title}</h1>
|
<h1 class="text-2xl">{post.frontmatter.title}</h1>
|
||||||
<p class="text-sm">{post.frontmatter.description}</p>
|
<p class="text-sm">{post.frontmatter.description}</p>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
layout: '../../layouts/post.astro'
|
layout: '../../layouts/post.astro'
|
||||||
title: 'Threaded JavaScript!'
|
title: 'Threaded JavaScript!'
|
||||||
|
date: '10/04/2022'
|
||||||
---
|
---
|
||||||
|
|
||||||
# Threaded Javascript
|
# Threaded Javascript
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
layout: '../../layouts/post.astro'
|
layout: '../../layouts/post.astro'
|
||||||
title: 'Deepwork - Cal Newport'
|
title: 'Deepwork - Cal Newport'
|
||||||
|
date: '16/08/2022'
|
||||||
---
|
---
|
||||||
|
|
||||||
# Deepwork - Cal Newport. A review
|
# Deepwork - Cal Newport. A review
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
layout: '../../layouts/post.astro'
|
layout: '../../layouts/post.astro'
|
||||||
title: 'The Republic by Plate - A recap / review'
|
title: 'The Republic by Plate - A recap / review'
|
||||||
|
date: '05/01/2020'
|
||||||
---
|
---
|
||||||
|
|
||||||
# The Republic - Plate
|
# The Republic - Plate
|
||||||
|
Reference in New Issue
Block a user