diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0eed94..89ca5c5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -346,3 +346,15 @@
### Fix
- 修复了搜索组件无法正常加载的问题
+
+## [2.5.5] - 2024-8-18
+
+### Features
+
+- 添加了置顶功能,现在你可以给文章 badge 属性 设置为 `Pin` 来置顶你的文章
+
+### Refactored
+
+- 清理了项目代码
+- 修改了侧边卡片的样式
+- 修改了原 DaisyUI 内建的逻辑,改成点击按钮收回而不是点击外部收回
diff --git a/package-lock.json b/package-lock.json
index 33a772e..2524f22 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "frosti",
- "version": "2.5.4-hotfix.1",
+ "version": "2.5.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "frosti",
- "version": "2.5.4-hotfix.1",
+ "version": "2.5.5",
"dependencies": {
"@astrojs/check": "^0.8.3",
"@astrojs/mdx": "^2.3.1",
diff --git a/package.json b/package.json
index 1d5f40b..88f1c37 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "frosti",
"type": "module",
- "version": "2.5.4-hotfix.1",
+ "version": "2.5.5",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
diff --git a/src/components/Header.astro b/src/components/Header.astro
index 8fc8d47..3eddb8a 100644
--- a/src/components/Header.astro
+++ b/src/components/Header.astro
@@ -7,27 +7,29 @@ import { SITE_TITLE } from "../consts";
class="navbar max-md:translate-y-0 fixed px-2 w-full transform -translate-y-full text-center z-50 transition-transform bg-base-100 shadow-xl"
>
{SITE_TITLE}
diff --git a/src/components/HeaderMenu.astro b/src/components/HeaderMenu.astro
index 18b15da..d9868f0 100644
--- a/src/components/HeaderMenu.astro
+++ b/src/components/HeaderMenu.astro
@@ -3,7 +3,7 @@ import { menuItems } from "../consts.ts";
---
{
menuItems.map((item) => (
diff --git a/src/components/blog/collapse.astro b/src/components/blog/collapse.astro
index 2967567..fc6ff92 100644
--- a/src/components/blog/collapse.astro
+++ b/src/components/blog/collapse.astro
@@ -2,10 +2,10 @@
const { title } = Astro.props;
---
-
+
diff --git a/src/content/blog/markdown-style-guide.md b/src/content/blog/markdown-style-guide.md
index 6d981ea..5bb0a42 100644
--- a/src/content/blog/markdown-style-guide.md
+++ b/src/content/blog/markdown-style-guide.md
@@ -7,7 +7,7 @@ categories:
- tech
tags:
- Makrdown
-badge: Guide
+badge: Pin
---
Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro.
diff --git a/src/pages/blog/[...page].astro b/src/pages/blog/[...page].astro
index e780dee..db79c23 100644
--- a/src/pages/blog/[...page].astro
+++ b/src/pages/blog/[...page].astro
@@ -9,8 +9,17 @@ import { infoTest } from "../../consts";
export async function getStaticPaths({ paginate }: { paginate: any }) {
const posts = await getCollection("blog");
- posts.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
- return paginate(posts, { pageSize: 8 });
+ const topPosts = posts.filter((post) => post.data.badge === "Pin");
+ const otherPosts = posts.filter((post) => post.data.badge !== "Pin");
+
+ topPosts.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
+ otherPosts.sort(
+ (a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
+ );
+
+ const sortedPosts = [...topPosts, ...otherPosts];
+
+ return paginate(sortedPosts, { pageSize: 8 });
}
const { page }: { page: Page } = Astro.props;
@@ -73,7 +82,7 @@ const pageLinks = generatePageLinks(totalPages);
href={page.url.prev ? page.url.prev : `javascript:`}
class={page.url.prev
? `btn bg-base-100 shadow-xl`
- : `btn btn-disabled bg-base-100 shadow-xl`}
+ : `btn btn-disabled bg-base-100 shadow-xl`}
>