Skip to content

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 question url title

aichy1264b3195131768
diff --git a/.goreleaser.yaml b/.goreleaser.yaml
index 3fd805af..42d62f49 100644
--- a/.goreleaser.yaml
+++ b/.goreleaser.yaml
@@ -30,9 +30,9 @@ changelog:
# modelines, feel free to remove those if you don't want/use them:
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
-
-# sudo apt-get install build-essential
+# sqlite3 need cgo to build
+# sudo apt-get install build-essential
# sudo apt-get install gcc-multilib g++-multilib
# sudo apt-get install gcc-mingw-w64
# sudo apt-get -y install gcc-aarch64-linux-gnu
-# goreleaser release --snapshot --rm-dist
\ No newline at end of file
+# goreleaser release --snapshot --rm-dist
diff --git a/internal/schema/question_schema.go b/internal/schema/question_schema.go
index 08f61d11..2e554afc 100644
--- a/internal/schema/question_schema.go
+++ b/internal/schema/question_schema.go
@@ -102,6 +102,7 @@ type QuestionBaseInfo struct {
type QuestionInfo struct {
ID string `json:"id" `
Title string `json:"title" xorm:"title"` // title
+ UrlTitle string `json:"url_title" xorm:"url_title"` // title
Content string `json:"content" xorm:"content"` // content
HTML string `json:"html" xorm:"html"` // html
Description string `json:"description"` //description
diff --git a/internal/service/question_common/question.go b/internal/service/question_common/question.go
index 0f732bc7..f606e038 100644
--- a/internal/service/question_common/question.go
+++ b/internal/service/question_common/question.go
@@ -11,6 +11,7 @@ import (
"github.com/answerdev/answer/internal/service/activity_queue"
"github.com/answerdev/answer/internal/service/config"
"github.com/answerdev/answer/internal/service/meta"
+ "github.com/answerdev/answer/pkg/htmltext"
"github.com/segmentfault/pacman/errors"
"github.com/answerdev/answer/internal/entity"
@@ -394,6 +395,7 @@ func (qs *QuestionCommon) ShowFormat(ctx context.Context, data *entity.Question)
info := schema.QuestionInfo{}
info.ID = data.ID
info.Title = data.Title
+ info.UrlTitle = htmltext.UrlTitle(data.Title)
info.Content = data.OriginalText
info.HTML = data.ParsedText
info.ViewCount = data.ViewCount