Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ tasks.named('classes') {
halo {
/* debug = true
suspend = true*/
version = '2.23.1'
version = '2.24'
}

24 changes: 1 addition & 23 deletions src/main/java/cc/lik/timefactor/process/TimeFactorProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,7 @@ private Mono<Void> processPostSeoData(ITemplateContext context, IModel model,
private Mono<Void> processCategorySeoData(ITemplateContext context, IModel model,
SeoOverride override) {
var modelFactory = context.getModelFactory();
// 分类详情页不注入 name 变量,从上下文的 CategoryVo 对象取 metadata.name
var categoryName = getMetadataNameFromVo(context, "category");
var categoryName = getNameVariable(context);
if (categoryName == null) {
return Mono.empty();
}
Expand Down Expand Up @@ -1237,27 +1236,6 @@ private String getNameVariable(ITemplateContext context) {
.filter(s -> !s.isBlank()).orElse(null);
}

/**
* 从上下文的 Vo 对象中获取 metadata.name。
*
* <p>Category 详情页不在上下文中注入独立的 {@code name} 变量,
* 需要通过 Vo 对象的 {@link ExtensionVoOperator#getMetadata()} 提取。
* 注意:第三方插件的 Vo(如 MomentVo)在上下文中可能是延迟加载的 Mono 对象,
* 此方法无法处理这种情况,会返回 null。
*
* @param context Thymeleaf 模板上下文
* @param voVariableName 上下文中 Vo 对象的变量名,如 "category"
* @return metadata.name,获取失败时返回 null
*/
private String getMetadataNameFromVo(ITemplateContext context, String voVariableName) {
var vo = context.getVariable(voVariableName);
if (vo instanceof ExtensionVoOperator evo) {
return Optional.ofNullable(evo.getMetadata()).map(MetadataOperator::getName)
.filter(s -> !s.isBlank()).orElse(null);
}
return null;
}

/**
* 判断字符串是否有实际内容(非 null 且非空白)。
* 用于输出阶段决定是否生成对应的 SEO 标签:无值则跳过,避免输出空标签。
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
name: time-factor
spec:
enabled: true
requires: ">=2.23.1"
requires: ">=2.24.0"
author:
name: Handsome
website: https://www.lik.cc
Expand Down
54 changes: 27 additions & 27 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,41 @@
"tabWidth": 2
},
"dependencies": {
"@halo-dev/api-client": "^2.23.0",
"@halo-dev/components": "^2.23.0",
"@halo-dev/ui-shared": "^2.23.0",
"axios": "^1.13.6",
"@halo-dev/api-client": "^2.24.0",
"@halo-dev/components": "^2.24.0",
"@halo-dev/ui-shared": "^2.24.0",
"axios": "^1.15.2",
"canvas-confetti": "^1.9.4",
"pinia": "^3.0.4",
"vue": "^3.5.30",
"vue-router": "^4.6.4"
"vue": "^3.5.33",
"vue-router": "^5.0.6"
},
"devDependencies": {
"@halo-dev/ui-plugin-bundler-kit": "^2.23.0",
"@iconify/json": "^2.2.454",
"@rsbuild/core": "^1.7.3",
"@halo-dev/ui-plugin-bundler-kit": "^2.24.0",
"@iconify/json": "^2.2.466",
"@rsbuild/core": "^2.0.1",
"@rsbuild/plugin-sass": "^1.5.1",
"@tsconfig/node20": "^20.1.9",
"@types/canvas-confetti": "^1.9.0",
"@types/jsdom": "^21.1.7",
"@types/node": "^20.19.37",
"@vitest/eslint-plugin": "^1.6.13",
"@types/jsdom": "^28.0.1",
"@types/node": "^25.6.0",
"@vitest/eslint-plugin": "^1.6.16",
"@vue/eslint-config-prettier": "^10.2.0",
"@vue/eslint-config-typescript": "^14.7.0",
"@vue/test-utils": "^2.4.6",
"@vue/tsconfig": "^0.7.0",
"eslint": "^9.39.4",
"eslint-plugin-oxlint": "^0.16.12",
"eslint-plugin-vue": "~10.0.1",
"jsdom": "^26.1.0",
"npm-run-all2": "^7.0.2",
"oxlint": "^0.16.12",
"prettier": "^3.8.1",
"sass": "^1.98.0",
"typescript": "~5.8.3",
"unplugin-icons": "^22.5.0",
"vitest": "^3.2.4",
"vue-tsc": "^2.2.12"
"@vue/test-utils": "^2.4.8",
"@vue/tsconfig": "^0.9.1",
"eslint": "^10.2.1",
"eslint-plugin-oxlint": "^1.61.0",
"eslint-plugin-vue": "~10.9.0",
"jsdom": "^29.0.2",
"npm-run-all2": "^8.0.4",
"oxlint": "^1.61.0",
"prettier": "^3.8.3",
"sass": "^1.99.0",
"typescript": "~6.0.3",
"unplugin-icons": "^23.0.1",
"vitest": "^4.1.5",
"vue-tsc": "^3.2.7"
},
"packageManager": "pnpm@9.15.9"
"packageManager": "pnpm@10.33.2"
}
Loading
Loading