@windcoder/astro-theme-orchid 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils.ts +4 -2
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -81,10 +81,12 @@ export function hexToHsl(hex: string): { h: number; s: number; l: number } {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
/**
|
|
84
|
+
/** 排序:置顶优先,其余按发布时间倒序;草稿过滤跟随环境(PROD 剪除,dev 放行以供预览,
|
|
85
|
+
* 与 14 处 getCollection 的 PROD/dev 分支同口径——否则 dev 下 getCollection 放行的草稿
|
|
86
|
+
* 会在此被二次剪除,导致分类/文章详情等 getStaticPaths 链路 404) */
|
|
85
87
|
export function getSortedPosts<T extends PostLike>(posts: T[]): T[] {
|
|
86
88
|
return posts
|
|
87
|
-
.filter((p) => !p.data.draft)
|
|
89
|
+
.filter((p) => (import.meta.env.PROD ? !p.data.draft : true))
|
|
88
90
|
.sort((a, b) => {
|
|
89
91
|
if (a.data.pinned !== b.data.pinned) return a.data.pinned ? -1 : 1;
|
|
90
92
|
return b.data.published.getTime() - a.data.published.getTime();
|