mirror of https://gitee.com/answerdev/answer.git
Merge branch 'feat/0.6.0/seo' into test
This commit is contained in:
commit
f72f89f0b8
|
@ -172,7 +172,7 @@ func (tc *TemplateController) QuestionInfo(ctx *gin.Context) {
|
||||||
jsonLD.Type = "QAPage"
|
jsonLD.Type = "QAPage"
|
||||||
jsonLD.MainEntity.Type = "Question"
|
jsonLD.MainEntity.Type = "Question"
|
||||||
jsonLD.MainEntity.Name = detail.Title
|
jsonLD.MainEntity.Name = detail.Title
|
||||||
jsonLD.MainEntity.Text = htmltext.ClearText(detail.HTML)
|
jsonLD.MainEntity.Text = detail.HTML
|
||||||
jsonLD.MainEntity.AnswerCount = int(answerCount)
|
jsonLD.MainEntity.AnswerCount = int(answerCount)
|
||||||
jsonLD.MainEntity.UpvoteCount = detail.VoteCount
|
jsonLD.MainEntity.UpvoteCount = detail.VoteCount
|
||||||
jsonLD.MainEntity.DateCreated = time.Unix(detail.CreateTime, 0)
|
jsonLD.MainEntity.DateCreated = time.Unix(detail.CreateTime, 0)
|
||||||
|
@ -182,7 +182,7 @@ func (tc *TemplateController) QuestionInfo(ctx *gin.Context) {
|
||||||
for _, answer := range answers {
|
for _, answer := range answers {
|
||||||
if answer.Adopted == schema.AnswerAdoptedEnable {
|
if answer.Adopted == schema.AnswerAdoptedEnable {
|
||||||
jsonLD.MainEntity.AcceptedAnswer.Type = "Answer"
|
jsonLD.MainEntity.AcceptedAnswer.Type = "Answer"
|
||||||
jsonLD.MainEntity.AcceptedAnswer.Text = htmltext.ClearText(answer.HTML)
|
jsonLD.MainEntity.AcceptedAnswer.Text = answer.HTML
|
||||||
jsonLD.MainEntity.AcceptedAnswer.UpvoteCount = answer.VoteCount
|
jsonLD.MainEntity.AcceptedAnswer.UpvoteCount = answer.VoteCount
|
||||||
jsonLD.MainEntity.AcceptedAnswer.URL = fmt.Sprintf("%s/%s", siteInfo.Canonical, answer.ID)
|
jsonLD.MainEntity.AcceptedAnswer.URL = fmt.Sprintf("%s/%s", siteInfo.Canonical, answer.ID)
|
||||||
jsonLD.MainEntity.AcceptedAnswer.Author.Type = "Person"
|
jsonLD.MainEntity.AcceptedAnswer.Author.Type = "Person"
|
||||||
|
@ -191,7 +191,7 @@ func (tc *TemplateController) QuestionInfo(ctx *gin.Context) {
|
||||||
} else {
|
} else {
|
||||||
item := &schema.SuggestedAnswerItem{}
|
item := &schema.SuggestedAnswerItem{}
|
||||||
item.Type = "Answer"
|
item.Type = "Answer"
|
||||||
item.Text = htmltext.ClearText(answer.HTML)
|
item.Text = answer.HTML
|
||||||
item.DateCreated = time.Unix(answer.CreateTime, 0)
|
item.DateCreated = time.Unix(answer.CreateTime, 0)
|
||||||
item.UpvoteCount = answer.VoteCount
|
item.UpvoteCount = answer.VoteCount
|
||||||
item.URL = fmt.Sprintf("%s/%s", siteInfo.Canonical, answer.ID)
|
item.URL = fmt.Sprintf("%s/%s", siteInfo.Canonical, answer.ID)
|
||||||
|
|
Loading…
Reference in New Issue