@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/utils.ts +4 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windcoder/astro-theme-orchid",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "清新简约的 Astro 博客主题,以 Integration 形式提供,支持版本化升级与组件覆盖",
5
5
  "type": "module",
6
6
  "keywords": [
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();