-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
66 lines (51 loc) · 1.66 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package gen
type Website struct {
Title string `yaml:"title"`
WebsiteUrl string `yaml:"url"`
SubTitle string `yaml:"subtitle"`
Description string `yaml:"description"`
Keywords string `yaml:"keywords"`
Markdown string `yaml:"markdown"` // md存储路径
Dist string `yaml:"output"` // 输出编译输出文件
Theme string `yaml:"theme"`
Author string `yaml:"author"`
Avatar string `yaml:"avatar"`
Contact string `yaml:"contact"`
Github string `yaml:"github"`
Mail string `yaml:"mail"`
PageSize int `yaml:"pageSize"`
Cates []string `yaml:"cate"`
Paths []string `yaml:"paths"`
Exts []string `yaml:"exts"`
HomeArtNum int `yaml:"pageNum"`
HomeTitle string `yaml:"home_title,omitempty"`
ArchiveTitle string `yaml:"archive_title,omitempty"`
TagTitle string `yaml:"tag_title,omitempty"`
CateTitle string `yaml:"cate_title,omitempty"`
AboutTitle string `yaml:"about_title,omitempty"`
ArticleTitle string `yaml:"article_title,omitempty"`
}
// Article 定义了一篇文章所需要的要素
type Article struct {
Id int `json:"article_id"`
Title string `json:"title"`
Description string `json:"description"`
Author string `json:"author"`
Summary string `json:"summary"`
Content string `json:"content"`
Tags []string `json:"tags"`
Category []string `json:"cate"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Url string `json:"url"`
}
type Articles []*Article
func (a Articles) Len() int {
return len(a)
}
func (a Articles) Less(i, j int) bool {
return a[i].CreatedAt > a[j].CreatedAt
}
func (a Articles) Swap(i, j int) {
a[i], a[j] = a[j], a[i]
}