feat(ai): 打通 SEO 闭环与投稿写作辅助

对齐 Zibll 的 AI 生成 SEO 流程:统一 WP AI Client/主题 Provider 双后端、文章/分类 SEO 框与生成回填、投稿摘要/标签建议,并收敛扩展页为连接配置。
This commit is contained in:
kate522 committed 2026-07-12 15:36:04 +08:00
1 parent a4cd5276e2
commit b36186da65
14 files changed
+1243 -330

No files matched your search

+31 -3
View File
@@ -126,9 +126,20 @@ class AKSRT_SEO_Head {
$term = get_queried_object();
if ($term instanceof WP_Term) {
$payload['canonical'] = (string) get_term_link($term);
$term_desc = trim(wp_strip_all_tags((string) term_description($term)));
if ($term_desc !== '') {
$payload['description'] = $term_desc;
$meta = $this->term_seo_meta((int) $term->term_id);
if ($meta['title'] !== '') {
$payload['title'] = $meta['title'];
}
if ($meta['description'] !== '') {
$payload['description'] = $meta['description'];
} else {
$term_desc = trim(wp_strip_all_tags((string) term_description($term)));
if ($term_desc !== '') {
$payload['description'] = $term_desc;
}
}
if ($meta['keywords'] !== '') {
$payload['keywords'] = $meta['keywords'];
}
}
}
@@ -163,6 +174,23 @@ class AKSRT_SEO_Head {
];
}
/**
* 读取 term SEO 覆盖。
*
* @return array{title:string,description:string,keywords:string}
*/
private function term_seo_meta(int $term_id): array {
$get = static function (string $key) use ($term_id): string {
return trim((string) get_term_meta($term_id, $key, true));
};
return [
'title' => $get('_aksrt_seo_title'),
'description' => $get('_aksrt_seo_description'),
'keywords' => $get('_aksrt_seo_keywords'),
];
}
/**
* 由分类/标签生成关键词回退。
*/