mirror of https://gitee.com/answerdev/answer.git
update AcceptedAnswer author
This commit is contained in:
parent
e2146ad50b
commit
15e174551a
|
@ -185,6 +185,9 @@ func (tc *TemplateController) QuestionInfo(ctx *gin.Context) {
|
|||
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)
|
||||
jsonLD.MainEntity.AcceptedAnswer.Author.Type = "Person"
|
||||
jsonLD.MainEntity.AcceptedAnswer.Author.Name = answer.UserInfo.DisplayName
|
||||
|
||||
} else {
|
||||
item := &schema.SuggestedAnswerItem{}
|
||||
item.Type = "Answer"
|
||||
|
|
|
@ -34,6 +34,10 @@ type AcceptedAnswerItem struct {
|
|||
Text string `json:"text"`
|
||||
UpvoteCount int `json:"upvoteCount"`
|
||||
URL string `json:"url"`
|
||||
Author struct {
|
||||
Type string `json:"@type"`
|
||||
Name string `json:"name"`
|
||||
} `json:"author"`
|
||||
}
|
||||
|
||||
type SuggestedAnswerItem struct {
|
||||
|
|
Loading…
Reference in New Issue