mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
fix: sort archive posts by pubDatetime (#415)
This commit is contained in:
@@ -59,7 +59,17 @@ const MonthMap: Record<string, string> = {
|
|||||||
<sup class="text-xs">{monthGroup.length}</sup>
|
<sup class="text-xs">{monthGroup.length}</sup>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
{monthGroup.map(({ data, slug }) => (
|
{monthGroup
|
||||||
|
.sort(
|
||||||
|
(a, b) =>
|
||||||
|
Math.floor(
|
||||||
|
new Date(b.data.pubDatetime).getTime() / 1000
|
||||||
|
) -
|
||||||
|
Math.floor(
|
||||||
|
new Date(a.data.pubDatetime).getTime() / 1000
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.map(({ data, slug }) => (
|
||||||
<Card href={`/posts/${slug}`} frontmatter={data} />
|
<Card href={`/posts/${slug}`} frontmatter={data} />
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user