update
This commit is contained in:
+1
-2
@@ -1,4 +1,3 @@
|
|||||||
.env
|
.env
|
||||||
/data
|
/data
|
||||||
/article
|
/article
|
||||||
/theme
|
|
||||||
@@ -35,13 +35,13 @@ func loadTemplates(templatesDir string) multitemplate.Renderer {
|
|||||||
func Router() *gin.Engine {
|
func Router() *gin.Engine {
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
|
|
||||||
themePath := os.Getenv("THEME_PATH")
|
themeName := os.Getenv("THEME_NAME")
|
||||||
if len(themePath) == 0 {
|
if len(themeName) == 0 {
|
||||||
themePath = "./theme_example"
|
themeName = "theme_example"
|
||||||
}
|
}
|
||||||
|
|
||||||
r.HTMLRender = loadTemplates(themePath + "/tmpl")
|
r.HTMLRender = loadTemplates("./theme/" + themeName + "/tmpl")
|
||||||
r.Static("/statics", themePath+"/statics")
|
r.Static("/statics", "./theme/"+themeName+"/statics")
|
||||||
|
|
||||||
r.GET("/", handler.Index)
|
r.GET("/", handler.Index)
|
||||||
r.GET("/article/:id", handler.GetArticle)
|
r.GET("/article/:id", handler.GetArticle)
|
||||||
|
|||||||
Reference in New Issue
Block a user