structs.go
1 package utils 2 3 import ( 4 "html/template" 5 "time" 6 ) 7 8 // --- TOML structs ---// 9 type Gibson struct { 10 IP string `toml:"ip"` 11 Port int `toml:"port"` 12 Directory string `toml:"directory"` 13 Version string `toml:"version"` 14 } 15 16 type Blog struct { 17 URL string `toml:"URL"` 18 Title string `toml:"Title"` 19 Desc string `toml:"Desc"` 20 Language string `toml:"Language"` 21 Copyright string `toml:"Copyright"` 22 } 23 24 type S3 struct { 25 Endpoint string `toml:"endpoint"` 26 AccessKeyID string `toml:"accessKeyID"` 27 SecretAccessKey string `toml:"secretAccessKey"` 28 Region string `toml:"region"` 29 Bucket string `toml:"bucket"` 30 Directory string `toml:"directory"` 31 Tmp string `toml:"tmp"` 32 } 33 34 type Rss struct { 35 Name string `toml:"name"` 36 URL string `toml:"url"` 37 Refresh int `toml:"refresh"` 38 Items int `toml:"items"` 39 } 40 41 type Pinned struct { 42 Name string `toml:"name"` 43 URL string `toml:"url"` 44 } 45 46 type Link struct { 47 Name string `toml:"name"` 48 URL string `toml:"url"` 49 } 50 51 type TomlConfig struct { 52 Gibson Gibson 53 Blog Blog 54 S3 S3 55 RSS map[string]Rss 56 Pinned map[string]Pinned 57 Link map[string]Link 58 } 59 60 //--------------------// 61 62 type FeedRss struct { 63 Name string 64 Items []ItemRss 65 } 66 67 type ItemRss struct { 68 Description string 69 Title string 70 Link string 71 } 72 73 type ExternalData struct { 74 Categories []ExternalCategory 75 } 76 77 type Data struct { 78 Categories []Category 79 TagsPosts []TagPosts 80 } 81 82 type ExternalCategory struct { 83 Name string 84 Pages []ExternalPost 85 } 86 87 type Category struct { 88 Name string 89 Pages []BlogPost 90 NbPosts int 91 CurrentPage int 92 NBpages int 93 } 94 95 type TagPosts struct { 96 Tag map[string][]BlogPost 97 } 98 99 type JsonPosts struct { 100 results map[string][]BlogPost 101 } 102 103 type ExternalPost struct { 104 Id int `json:"id"` 105 Title string `json:"title"` 106 Source string `json:"source"` 107 Author string `json:"author"` 108 Slug string `json:"slug"` 109 Content template.HTML `json:"content"` 110 Description string `json:"description"` 111 Published time.Time `json:"published"` 112 Headers []string `json:"-"` 113 } 114 115 type BlogPost struct { 116 Id int `json:"id"` 117 Title string `json:"title"` 118 Slug string `json:"slug"` 119 Parent string `json:"-"` 120 Content template.HTML `json:"content"` 121 Description string `json:"description"` 122 Tags []string `json:"tags"` 123 Date time.Time `json:"date"` 124 Headers []string `json:"-"` 125 MetaDescription string `json:"-"` 126 MetaPropertyTitle string `json:"-"` 127 MetaPropertyDescription string `json:"-"` 128 MetaOgURL string `json:"url"` 129 } 130 131 type JsonBlogPost struct { 132 Id int `json:"id"` 133 Title string `json:"title"` 134 Slug string `json:"slug"` 135 Description string `json:"description"` 136 Tags []string `json:"tags"` 137 } 138 139 type Payload struct { 140 BlogTitle string 141 BlogDesc string 142 BlogCopyright string 143 Version string 144 FeedRss []FeedRss 145 PinnedPosts []Pinned 146 Links []Link 147 Title string 148 Date string 149 Content template.HTML 150 ExternalData ExternalData 151 PagesData Data 152 PostsData Data 153 TextesData Data 154 Headers []string 155 Description string 156 Tags []string 157 SidebarLinks template.HTML 158 CurrentSlug string 159 MetaDescription string 160 MetaPropertyTitle string 161 MetaPropertyDescription string 162 MetaOgURL string 163 Source string 164 Author string 165 }