Merge branch 'feat/0.7.0/seo' into test

This commit is contained in:
aichy126 2022-12-16 16:25:14 +08:00
commit 5391d3100a
4 changed files with 43 additions and 0 deletions

2
.gitignore vendored
View File

@ -23,3 +23,5 @@ tmp
vendor/
/answer-data/
/answer
dist/

38
.goreleaser.yaml Normal file
View File

@ -0,0 +1,38 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
builds:
- env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
main: ./cmd/answer/.
goos:
- linux
archives:
- replacements:
linux: Linux
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
# 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
# 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

View File

@ -122,6 +122,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

View File

@ -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