短剧 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:
@@ -1623,6 +1623,10 @@ func applyPlayletDescription(doc *playletmod.Playlet) {
|
|||||||
}
|
}
|
||||||
doc.Description = description
|
doc.Description = description
|
||||||
doc.SeoInfo.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) {
|
func applyPlayletDescriptionOnUpdate(exist *playletmod.Playlet, req *proto.PlayletUpdateReq, setDoc bson.M) {
|
||||||
@@ -1636,6 +1640,10 @@ func applyPlayletDescriptionOnUpdate(exist *playletmod.Playlet, req *proto.Playl
|
|||||||
if playName == "" {
|
if playName == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
title := strings.TrimSpace(exist.Title)
|
||||||
|
if req.Title != nil {
|
||||||
|
title = strings.TrimSpace(*req.Title)
|
||||||
|
}
|
||||||
desc := exist.Desc
|
desc := exist.Desc
|
||||||
if req.Desc != nil {
|
if req.Desc != nil {
|
||||||
desc = strings.TrimSpace(*req.Desc)
|
desc = strings.TrimSpace(*req.Desc)
|
||||||
@@ -1658,7 +1666,11 @@ func applyPlayletDescriptionOnUpdate(exist *playletmod.Playlet, req *proto.Playl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
seo = normalizeSeoValue(seo)
|
seo = normalizeSeoValue(seo)
|
||||||
|
// 每次 description 更新 → SEO 描述、SEO 标题同步。
|
||||||
seo.Description = description
|
seo.Description = description
|
||||||
|
if title != "" {
|
||||||
|
seo.Title = title
|
||||||
|
}
|
||||||
setDoc["seoInfo"] = seo
|
setDoc["seoInfo"] = seo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user