added catch for empty blog posts

This commit is contained in:
rawleyIfowler
2022-02-26 10:20:08 -06:00
parent b1c76c2094
commit a13e1f5c87

View File

@@ -61,10 +61,9 @@ func RegisterBlogGroup(r *gin.RouterGroup) {
func RenderBlogPage(c *gin.Context) {
posts := GetAllBlogPosts()
if posts == nil {
c.HTML(http.StatusInternalServerError, "internal_server_error.tmpl", gin.H{})
} else {
c.HTML(http.StatusOK, "blog.tmpl", posts)
posts = &[]models.BlogPost{}
}
c.HTML(http.StatusOK, "blog.tmpl", posts)
}
func RenderIndividualBlogPost(c *gin.Context) {