A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
update AcceptedAnswer
aichy126e2146ad50b30
diff --git a/internal/controller/template_controller.go b/internal/controller/template_controller.goindex d4355037..efe391e3 100644--- a/internal/controller/template_controller.go+++ b/internal/controller/template_controller.go@@ -180,15 +180,23 @@ func (tc *TemplateController) QuestionInfo(ctx *gin.Context) {jsonLD.MainEntity.Author.Name = detail.UserInfo.DisplayNameanswerList := make([]*schema.SuggestedAnswerItem, 0)for _, answer := range answers {- item := &schema.SuggestedAnswerItem{}- item.Type = "Answer"- item.Text = htmltext.ClearText(answer.HTML)- item.DateCreated = time.Unix(answer.CreateTime, 0)- item.UpvoteCount = answer.VoteCount- item.URL = fmt.Sprintf("%s/%s", siteInfo.Canonical, answer.ID)- item.Author.Type = "Person"- item.Author.Name = answer.UserInfo.DisplayName- answerList = append(answerList, item)+ if answer.Adopted == schema.AnswerAdoptedEnable {+ jsonLD.MainEntity.AcceptedAnswer.Type = "Answer"+ jsonLD.MainEntity.AcceptedAnswer.Text = htmltext.ClearText(answer.HTML)+ jsonLD.MainEntity.AcceptedAnswer.UpvoteCount = answer.VoteCount+ jsonLD.MainEntity.AcceptedAnswer.URL = fmt.Sprintf("%s/%s", siteInfo.Canonical, answer.ID)+ } else {+ item := &schema.SuggestedAnswerItem{}+ item.Type = "Answer"+ item.Text = htmltext.ClearText(answer.HTML)+ item.DateCreated = time.Unix(answer.CreateTime, 0)+ item.UpvoteCount = answer.VoteCount+ item.URL = fmt.Sprintf("%s/%s", siteInfo.Canonical, answer.ID)+ item.Author.Type = "Person"+ item.Author.Name = answer.UserInfo.DisplayName+ answerList = append(answerList, item)+ }+}jsonLD.MainEntity.SuggestedAnswer = answerListjsonLDStr, err := json.Marshal(jsonLD)