--- import type { CollectionEntry } from 'astro:content'; interface Props { title?: string; articles: CollectionEntry<'articles'>[]; } const { title = "文章时间线", articles = [] } = Astro.props; // 按日期排序文章 const sortedArticles = articles.sort( (a, b) => b.data.date.getTime() - a.data.date.getTime() ); ---
{title &&

{title}

}
{sortedArticles.length > 0 ? ( sortedArticles.map((article, index) => { const isEven = index % 2 === 0; return ( ); }) ) : (
暂无文章数据
)}