This commit is contained in:
2023-03-10 14:51:34 +08:00
parent f8c1d183e4
commit 7a9c671044
6 changed files with 6 additions and 7 deletions
-1
View File
@@ -1,4 +1,3 @@
.env .env
/data /data
/article /article
/theme
+5 -5
View File
@@ -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)