@@ -135,6 +135,7 @@ func FetchPosts(c *gin.Context) {
135135 }
136136
137137 c .HTML (http .StatusOK , "index.html" , map [string ]any {
138+ "Title" : pageQuery .CategoryName ,
138139 "Posts" : discussions ,
139140 "Navbars" : config .Categories ,
140141 "About" : config .About ,
@@ -167,6 +168,21 @@ func FetchPost(c *gin.Context) {
167168 })
168169}
169170
171+ func TagPage (c * gin.Context ) {
172+ labels , err := api .FetchAllLabels ()
173+ if err != nil {
174+ c .HTML (http .StatusBadRequest , "error.html" , map [string ]any {
175+ "Message" : err .Error (),
176+ })
177+ return
178+ }
179+ c .HTML (http .StatusOK , "tags.html" , map [string ]any {
180+ "Labels" : labels ,
181+ "Navbars" : config .Categories ,
182+ "About" : config .About ,
183+ })
184+ }
185+
170186func AboutPage (c * gin.Context ) {
171187 discussion , err := api .FetchPost (config .About )
172188 if err != nil {
@@ -226,6 +242,7 @@ func main() {
226242 r .GET ("/" , cache .CacheByRequestURI (memoryCache , 30 * time .Second ), FetchPosts )
227243 r .GET ("/category/:category_id/:category_name" , cache .CacheByRequestURI (memoryCache , 30 * time .Second ), FetchPosts )
228244 r .GET ("/post/:id/:title" , cache .CacheByRequestURI (memoryCache , 1 * time .Hour ), FetchPost )
245+ r .GET ("/tags" , cache .CacheByRequestURI (memoryCache , 24 * time .Hour ), TagPage )
229246 r .GET ("/atom.xml" , cache .CacheByRequestURI (memoryCache , 24 * time .Hour ), GenerateFeed )
230247 r .GET ("/404" , func (ctx * gin.Context ) {
231248 ctx .HTML (http .StatusOK , "error.html" , nil )
0 commit comments