add post list

This commit is contained in:
张超
2024-08-02 21:47:22 +08:00
parent 4a447041e9
commit e974da8adb
2 changed files with 106 additions and 11 deletions

View File

@@ -51,7 +51,7 @@ func main() {
func registerRoutes(r *gin.Engine) {
var items []models.Content
models.DB.Select("*").Find(&items)
models.DB.Select("*").Limit(5).Find(&items, "type = ?", "post")
r.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.tmpl", gin.H{
"Items": items,