update
This commit is contained in:
+4
-4
@@ -14,7 +14,7 @@ func Index(c *gin.Context) {
|
||||
if p < 1 {
|
||||
p = 1
|
||||
}
|
||||
limit := 100
|
||||
limit := 5
|
||||
start := (p - 1) * limit
|
||||
|
||||
list := make([]*Article, 0)
|
||||
@@ -44,9 +44,9 @@ func Index(c *gin.Context) {
|
||||
nextPage = p + 1
|
||||
}
|
||||
|
||||
prevPage := 1
|
||||
if p > 2 {
|
||||
prevPage = p + 1
|
||||
prevPage := 0
|
||||
if p >= 2 {
|
||||
prevPage = p - 1
|
||||
}
|
||||
|
||||
title := os.Getenv("HOME_TITLE")
|
||||
|
||||
@@ -40,9 +40,15 @@ func Router() *gin.Engine {
|
||||
themeName = "theme_example"
|
||||
}
|
||||
|
||||
r.HTMLRender = loadTemplates("./theme/" + themeName + "/tmpl")
|
||||
r.Static("/statics", "./theme/"+themeName+"/statics")
|
||||
r.StaticFile("/favicon.ico", "./theme/"+themeName+"/favicon.ico")
|
||||
themPath := "./theme/" + themeName
|
||||
|
||||
if len(os.Getenv("THEME_PATH")) > 0 {
|
||||
themPath = os.Getenv("THEME_PATH")
|
||||
}
|
||||
|
||||
r.HTMLRender = loadTemplates(themPath + "/tmpl")
|
||||
r.Static("/statics", themPath+"/statics")
|
||||
r.StaticFile("/favicon.ico", themPath+"/favicon.ico")
|
||||
|
||||
r.GET("/", handler.Index)
|
||||
r.GET("/article/:id", handler.GetArticle)
|
||||
|
||||
Reference in New Issue
Block a user