短剧 SEO 标题跟随 Playlet.Title 同步
每次创建/更新时,把 Playlet.Title 覆盖写入 SeoInfo.Title,与 Description(desc + 自动模板) 一起保持前后台 SEO 字段同步。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1619,6 +1619,10 @@ func applyPlayletDescription(doc *playletmod.Playlet) {
|
||||
}
|
||||
doc.Description = description
|
||||
doc.SeoInfo.Description = description
|
||||
// SEO 标题跟随 Playlet.Title 同步。
|
||||
if title := strings.TrimSpace(doc.Title); title != "" {
|
||||
doc.SeoInfo.Title = title
|
||||
}
|
||||
}
|
||||
|
||||
func applyPlayletDescriptionOnUpdate(exist *playletmod.Playlet, req *proto.PlayletUpdateReq, setDoc bson.M) {
|
||||
@@ -1632,6 +1636,10 @@ func applyPlayletDescriptionOnUpdate(exist *playletmod.Playlet, req *proto.Playl
|
||||
if playName == "" {
|
||||
return
|
||||
}
|
||||
title := strings.TrimSpace(exist.Title)
|
||||
if req.Title != nil {
|
||||
title = strings.TrimSpace(*req.Title)
|
||||
}
|
||||
desc := exist.Desc
|
||||
if req.Desc != nil {
|
||||
desc = strings.TrimSpace(*req.Desc)
|
||||
@@ -1654,7 +1662,11 @@ func applyPlayletDescriptionOnUpdate(exist *playletmod.Playlet, req *proto.Playl
|
||||
}
|
||||
}
|
||||
seo = normalizeSeoValue(seo)
|
||||
// 每次 description 更新 → SEO 描述、SEO 标题同步。
|
||||
seo.Description = description
|
||||
if title != "" {
|
||||
seo.Title = title
|
||||
}
|
||||
setDoc["seoInfo"] = seo
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user