From 7a9c671044b02b71f45bef9f90f5250ad1272512 Mon Sep 17 00:00:00 2001 From: woon Date: Fri, 10 Mar 2023 14:51:34 +0800 Subject: [PATCH] update --- .gitignore | 3 +-- router.go | 10 +++++----- .../statics/css/github-markdown-light.css | 0 .../theme_example}/tmpl/article.html | 0 {theme_example => theme/theme_example}/tmpl/index.html | 0 .../theme_example}/tmpl/layouts/base.html | 0 6 files changed, 6 insertions(+), 7 deletions(-) rename {theme_example => theme/theme_example}/statics/css/github-markdown-light.css (100%) rename {theme_example => theme/theme_example}/tmpl/article.html (100%) rename {theme_example => theme/theme_example}/tmpl/index.html (100%) rename {theme_example => theme/theme_example}/tmpl/layouts/base.html (100%) diff --git a/.gitignore b/.gitignore index cc0b434..31402e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ .env /data -/article -/theme \ No newline at end of file +/article \ No newline at end of file diff --git a/router.go b/router.go index 622a00a..e4605e5 100644 --- a/router.go +++ b/router.go @@ -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) diff --git a/theme_example/statics/css/github-markdown-light.css b/theme/theme_example/statics/css/github-markdown-light.css similarity index 100% rename from theme_example/statics/css/github-markdown-light.css rename to theme/theme_example/statics/css/github-markdown-light.css diff --git a/theme_example/tmpl/article.html b/theme/theme_example/tmpl/article.html similarity index 100% rename from theme_example/tmpl/article.html rename to theme/theme_example/tmpl/article.html diff --git a/theme_example/tmpl/index.html b/theme/theme_example/tmpl/index.html similarity index 100% rename from theme_example/tmpl/index.html rename to theme/theme_example/tmpl/index.html diff --git a/theme_example/tmpl/layouts/base.html b/theme/theme_example/tmpl/layouts/base.html similarity index 100% rename from theme_example/tmpl/layouts/base.html rename to theme/theme_example/tmpl/layouts/base.html