20 lines
523 B
Plaintext
20 lines
523 B
Plaintext
---
|
|
import BaseLayout from '../../layouts/BaseLayout.astro';
|
|
import { getCollection } from 'astro:content';
|
|
|
|
const news = (await getCollection('news')).sort(
|
|
(a, b) => b.data.date.getTime() - a.data.date.getTime()
|
|
);
|
|
---
|
|
<BaseLayout title="新闻动态">
|
|
<h1>新闻动态</h1>
|
|
<ul>
|
|
{news.map((post) => (
|
|
<li>
|
|
<a href={`/news/${post.id}/`}>{post.data.title}</a>
|
|
<small> · {post.data.category} · {post.data.date.toLocaleDateString('zh-CN')}</small>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</BaseLayout>
|