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 -2
View File
@@ -1,4 +1,3 @@
.env
/data
/article
/theme
/article
+5 -5
View File
@@ -35,13 +35,13 @@ func loadTemplates(templatesDir string) multitemplate.Renderer {
func Router() *gin.Engine {
r := gin.Default()
themePath := os.Getenv("THEME_PATH")
if len(themePath) == 0 {
themePath = "./theme_example"
themeName := os.Getenv("THEME_NAME")
if len(themeName) == 0 {
themeName = "theme_example"
}
r.HTMLRender = loadTemplates(themePath + "/tmpl")
r.Static("/statics", themePath+"/statics")
r.HTMLRender = loadTemplates("./theme/" + themeName + "/tmpl")
r.Static("/statics", "./theme/"+themeName+"/statics")
r.GET("/", handler.Index)
r.GET("/article/:id", handler.GetArticle)