feat: move articles link from 'blog/' to 'post/' paths

This commit is contained in:
grassblock 2025-05-04 11:42:09 +08:00
parent 350f6f3865
commit 7e5f8ce06f
9 changed files with 15 additions and 9 deletions

View file

@ -2,7 +2,7 @@
import Layout from '../layouts/Layout.astro';
import { getCollection } from 'astro:content';
const posts = await getCollection('blog');
const posts = await getCollection('posts');
posts.sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDate).getTime());
---
@ -18,7 +18,7 @@ posts.sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDat
{posts.map((post) => (
<p>
<span style="color: var(--terminal-yellow);">{new Date(post.data.pubDate).toISOString().split('T')[0]}</span>
<a href={`/blog/${post.slug}`}>{post.data.title}</a>
<a href={`/post/${post.slug}`}>{post.data.title}</a>
</p>
))}