+ [置顶] {{ title }}
number) {
url,
excerpt,
date: formatDate(frontmatter.date),
+ pinned: frontmatter.pinned === true,
}))
- .sort((a, b) => b.date.time - a.date.time)
+ // .sort((a, b) => b.date.time - a.date.time)
+ .sort((a, b) => {
+ if (a.pinned && !b.pinned) {
+ return -1
+ } else if (!a.pinned && b.pinned) {
+ return 1
+ } else {
+ return b.date.time - a.date.time
+ }
+ })
const postsPerPage = getPostsPerPage()
const numPages = Math.ceil(posts.length / postsPerPage)
await createPagesDynamicRoutesWithCache(numPages)
diff --git a/src/posts/2023-os-report.md b/src/posts/2023-os-report.md
index c1e9bf1..9852e32 100644
--- a/src/posts/2023-os-report.md
+++ b/src/posts/2023-os-report.md
@@ -4,6 +4,7 @@ date: 2023-12-02
author:
name: 梦师傅
github: Ligoml
+pinned: true
---
什么是开源项目和开源社区?国内活跃度 Top 的开源社区,都有哪些有趣的人和事?开源社区之于开源项目有何重要意义?