user viper
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"go_blog/models"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Home(c *gin.Context) {
|
||||
c.HTML(http.StatusOK, "home.html", gin.H{
|
||||
"title": "首页",
|
||||
|
||||
var items []models.Content
|
||||
models.DB.Select("*").Limit(5).Find(&items, "type = ?", "post")
|
||||
c.HTML(http.StatusOK, "index.tmpl", gin.H{
|
||||
"Items": items,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user