@sugarat/theme 0.1.27 → 0.1.28

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 (3) hide show
  1. package/node.js +3 -1
  2. package/package.json +2 -2
  3. package/src/node.ts +10 -3
package/node.js CHANGED
@@ -106,7 +106,9 @@ function getThemeConfig(cfg) {
106
106
  new Date(`${new Date(meta.date).toUTCString()}+8`)
107
107
  );
108
108
  }
109
- meta.tag = (meta.tag || []).concat([
109
+ meta.categories = typeof meta.categories === "string" ? [meta.categories] : meta.categories;
110
+ meta.tags = typeof meta.tags === "string" ? [meta.tags] : meta.tags;
111
+ meta.tag = [meta.tag || []].flat().concat([
110
112
  .../* @__PURE__ */ new Set([...meta.categories || [], ...meta.tags || []])
111
113
  ]);
112
114
  const wordCount = 100;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sugarat/theme",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -46,7 +46,7 @@
46
46
  "sass": "^1.56.1",
47
47
  "tsup": " ^6.5.0",
48
48
  "typescript": "^4.8.2",
49
- "vitepress": "1.0.0-alpha.74",
49
+ "vitepress": "1.0.0-alpha.75",
50
50
  "vue": "^3.2.45"
51
51
  },
52
52
  "scripts": {
package/src/node.ts CHANGED
@@ -63,9 +63,16 @@ export function getThemeConfig(cfg?: Partial<Theme.BlogConfig>) {
63
63
  }
64
64
 
65
65
  // 处理tags和categories,兼容历史文章
66
- meta.tag = (meta.tag || []).concat([
67
- ...new Set([...(meta.categories || []), ...(meta.tags || [])])
68
- ])
66
+ meta.categories =
67
+ typeof meta.categories === 'string'
68
+ ? [meta.categories]
69
+ : meta.categories
70
+ meta.tags = typeof meta.tags === 'string' ? [meta.tags] : meta.tags
71
+ meta.tag = [meta.tag || []]
72
+ .flat()
73
+ .concat([
74
+ ...new Set([...(meta.categories || []), ...(meta.tags || [])])
75
+ ])
69
76
 
70
77
  // 获取摘要信息
71
78
  const wordCount = 100