From efca4b052ccec24bb00e0bdfe35728d418c7ad7e Mon Sep 17 00:00:00 2001 From: zachary sun Date: Thu, 20 Mar 2025 18:00:59 +0800 Subject: [PATCH 1/6] feature_category --- CONTRIBUTING.md | 35 +++++++++++++++++ src/.vitepress/theme/BlogCategories.vue | 35 +++++++++++++++++ src/.vitepress/theme/Home.vue | 50 ++++++++++++++++++++++--- src/.vitepress/theme/loaders/posts.ts | 2 + src/posts/2023-os-report.md | 1 + src/posts/2024-summary.md | 1 + src/posts/buaa-starter.md | 1 + src/posts/ccf-pku.md | 1 + src/posts/chengdu-kaiyuanshe.md | 2 +- src/posts/chuan-story.md | 1 + src/posts/deepseek-tech-visualized.md | 1 + src/posts/hackathon-5th-episode01.md | 1 + src/posts/hackathon-5th-episode02.md | 1 + src/posts/hackathon-5th-episode03.md | 1 + src/posts/hackathon-6th-summary.md | 1 + src/posts/hackathon-7th-summary.md | 1 + src/posts/huanggua-story.md | 1 + src/posts/huangjiyi-story.md | 1 + src/posts/ijcai-2024-competition.md | 1 + src/posts/ligoml-story.md | 1 + src/posts/limin-story.md | 1 + src/posts/loaf-sharing.md | 1 + src/posts/lzj-sharing.md | 1 + src/posts/nknan-story.md | 1 + src/posts/paddle-pipeline-parallel.md | 1 + src/posts/paddleocr-release.md | 1 + src/posts/pfcc-36th.md | 1 + src/posts/pku-course.md | 1 + src/posts/pytorch-conference-01.md | 1 + src/posts/sanbu-story.md | 1 + src/posts/shanghai-event.md | 1 + src/posts/shun-story.md | 1 + src/posts/starter-camp.md | 1 + src/posts/suzhou-kaifangyuanzi.md | 1 + src/posts/swagger-deepseek-r1.md | 1 + src/posts/tao-story.md | 1 + src/posts/type-hints-project.md | 1 + src/posts/wangxin-story.md | 1 + src/posts/wuxi-kaifangyuanzi.md | 1 + src/posts/xdoctest-project.md | 1 + src/posts/xian-event.md | 1 + src/posts/yanguohao-story.md | 1 + src/posts/zhangyiqiao-story.md | 1 + src/posts/zheng-story.md | 1 + src/posts/zju-event.md | 1 + src/posts/zuckerberg-letter-post.md | 1 + 46 files changed, 159 insertions(+), 6 deletions(-) create mode 100644 src/.vitepress/theme/BlogCategories.vue diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e4d6920..4d3db01 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,6 +56,41 @@ pnpm dev 文件名统一使用 kebab-case,如 `hello-world.md`。 +1. 博客置顶 + + 若有置顶某篇博客的需求,需要确保该博客文章在 frontmatter 中包含 `pinned: true` 字段。例如: + + ``` + --- + title: 2024 年飞桨开源社区年度报告 + date: 2025-02-07 + ... + pinned: true + --- + + 文章内容... + ``` + +2. 博客分类 + + 需要确保每篇博客文章在 frontmatter 中包含 `category` 字段,以便实现博客的分类展示。例如: + + ``` + --- + title: 文章标题 + date: 2025-04-01 + category: community-activity + --- + + 文章内容... + ``` + + | category 字段 | 含义 | + | ------------------ | ------------------------------ | + | community-activity | 飞桨开源社区动态、活动进展 | + | developer-story | 飞桨社区开发者访谈、开发者故事 | + | insights | 前沿洞察、技术分享 | + ### 图片文件 图片文件统一放置在 [`src/images`](./src/images) 目录下,每篇博客对应一个子目录,子目录名即为博客的文件名,比如 `hello-world.md` 对应的图片目录为 `src/images/hello-world`。 diff --git a/src/.vitepress/theme/BlogCategories.vue b/src/.vitepress/theme/BlogCategories.vue new file mode 100644 index 0000000..1e71c32 --- /dev/null +++ b/src/.vitepress/theme/BlogCategories.vue @@ -0,0 +1,35 @@ + + + \ No newline at end of file diff --git a/src/.vitepress/theme/Home.vue b/src/.vitepress/theme/Home.vue index 92da5af..f28ab03 100644 --- a/src/.vitepress/theme/Home.vue +++ b/src/.vitepress/theme/Home.vue @@ -1,22 +1,59 @@ @@ -31,6 +68,9 @@ const postsInPage = computed(() => {

{{ frontmatter.subtext || site.description }}

+ + + diff --git a/src/.vitepress/theme/loaders/posts.ts b/src/.vitepress/theme/loaders/posts.ts index 7d1828d..bc06a16 100644 --- a/src/.vitepress/theme/loaders/posts.ts +++ b/src/.vitepress/theme/loaders/posts.ts @@ -12,6 +12,7 @@ export interface Post { } excerpt: string | undefined pinned?: boolean + category?: string } export interface PostsData { @@ -80,6 +81,7 @@ export default function createPostsLoader(getPostsPerPage: () => number) { excerpt, date: formatDate(frontmatter.date), pinned: frontmatter.pinned === true, + category: frontmatter.category || 'all', })) .sort((a, b) => { if (a.pinned && !b.pinned) { diff --git a/src/posts/2023-os-report.md b/src/posts/2023-os-report.md index a03f5df..29ccf75 100644 --- a/src/posts/2023-os-report.md +++ b/src/posts/2023-os-report.md @@ -5,6 +5,7 @@ author: name: 梦师傅 github: Ligoml pinned: true +category: community-activity --- 什么是开源项目和开源社区?国内活跃度 Top 的开源社区,都有哪些有趣的人和事?开源社区之于开源项目有何重要意义? diff --git a/src/posts/2024-summary.md b/src/posts/2024-summary.md index 2b329a9..7ab0b46 100644 --- a/src/posts/2024-summary.md +++ b/src/posts/2024-summary.md @@ -5,6 +5,7 @@ author: name: 孙钟恺 github: sunzhongkai588 pinned: true +category: community-activity --- 2024 年已悄然落幕。这一年,飞桨开源社区在挑战与机遇中不断成长与突破。在这新年伊始,我们为大家呈上一份 2024 年度报告,以此致敬每一位开发者的努力与贡献。 diff --git a/src/posts/buaa-starter.md b/src/posts/buaa-starter.md index 0cd7209..1a4028c 100644 --- a/src/posts/buaa-starter.md +++ b/src/posts/buaa-starter.md @@ -4,6 +4,7 @@ date: 2024-11-27 author: name: 小莹莹 github: E-Pudding +category: community-activity ---