Skip to content

Commit fe0443a

Browse files
committed
✨ 搜索填充标签
1 parent b0634b9 commit fe0443a

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎controller/searchctl.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func searchAction(c *gin.Context) {
6565
Title: pangu.SpacingText(articleModel.Title),
6666
Abstract: mdResult.AbstractText,
6767
URL: getBlogURL(c) + articleModel.Path,
68+
Tags: themeTags,
6869
}
6970

7071
articles = append(articles, article)

‎model/themestruct.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type ThemeArticle struct {
2828
Author *ThemeAuthor `json:",omitempty"`
2929
CreatedAt string `json:",omitempty"`
3030
Title string `json:"title"`
31-
Tags []*ThemeTag `json:",omitempty"`
31+
Tags []*ThemeTag `json:"tags"`
3232
URL string `json:"url"`
3333
Topped bool `json:",omitempty"`
3434
ViewCount int `json:",omitempty"`
@@ -39,9 +39,9 @@ type ThemeArticle struct {
3939
}
4040

4141
type ThemeTag struct {
42-
Title string
43-
URL string
44-
ArticleCount int
42+
Title string `json:"title"`
43+
URL string `json:"url"`
44+
ArticleCount int `json:",omitempty"`
4545
}
4646

4747
type ThemeArchive struct {

0 commit comments

Comments
 (0)