From c7264e3ace8a6b1e22420702f00296a4bdadb6da Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Fri, 2 Feb 2024 23:25:31 -0500 Subject: Tags; More changes on blog --- src/pages/blog/[...slug].astro | 2 +- src/pages/blog/index.astro | 34 ++++++---------------------------- src/pages/blog/tags/[tag].astro | 25 +++++++++++++++---------- 3 files changed, 22 insertions(+), 39 deletions(-) (limited to 'src/pages/blog') diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 1eccb0b..e0b07e9 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -16,7 +16,7 @@ if(entry === undefined) { const { Content } = await entry.render(); --- - +
← All articles
diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index f782cdc..74f543a 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -2,8 +2,9 @@ import Page from "../../layouts/Page.astro"; import { getCollection } from "astro:content"; import {formatDate} from "../../util"; +import "../../styles/cards.css"; -const allBlogPosts = (await getCollection('blog')).sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf()); +const allBlogPosts = (await getCollection('blog')).sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()); ---
@@ -11,10 +12,12 @@ const allBlogPosts = (await getCollection('blog')).sort((a, b) => b.data.date.va {allBlogPosts.map((post) => (

{post.data.title}

- {formatDate(post.data.date)} + {formatDate(post.data.pubDate)}

{post.data.description}

- tag1 + {post.data.tags.map((tag) => ( + {tag} + ))}
)) @@ -23,34 +26,9 @@ const allBlogPosts = (await getCollection('blog')).sort((a, b) => b.data.date.va
diff --git a/src/pages/blog/tags/[tag].astro b/src/pages/blog/tags/[tag].astro index a43f13f..9d4ff86 100644 --- a/src/pages/blog/tags/[tag].astro +++ b/src/pages/blog/tags/[tag].astro @@ -1,6 +1,8 @@ --- import Page from '../../../layouts/Page.astro'; - +import {formatDate} from "../../../util"; +import "../../../styles/cards.css"; +export const prerender = true; export async function getStaticPaths() { const allPosts = await Astro.glob('../../../content/blog/*.md'); let uniqueTags = []; @@ -21,13 +23,16 @@ export async function getStaticPaths() { const { tag } = Astro.params; const { posts } = Astro.props; --- - - {console.log(posts)} - {posts && posts.map((post) => { - return ( - - ) - })} + +
+ {posts && posts.map((post) => { + return ( + + ) + })} +
-- cgit v1.2.3