From cf79d4d9e0da7844e838fb650c1a0c74a612ae84 Mon Sep 17 00:00:00 2001 From: xing Date: Mon, 19 Sep 2022 12:44:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route/route.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/route/route.go b/route/route.go index 7f12a64..dd5d64d 100644 --- a/route/route.go +++ b/route/route.go @@ -17,15 +17,14 @@ func SetupRouter() *gin.Engine { // Disable Console Color // gin.DisableConsoleColor() r := gin.Default() - r.SetFuncMap(template.FuncMap{ + r.HTMLRender = templates.NewFsTemplate(template.FuncMap{ "unescaped": func(s string) interface{} { return template.HTML(s) }, "dateCh": func(t time.Time) interface{} { return t.Format("2006年 01月 02日") }, - }) - r.HTMLRender = templates.NewFsTemplate(r.FuncMap).AddTemplate() + }).AddTemplate() r.Use(middleware.SetStaticFileCache) //gzip 因为一般会用nginx做反代时自动使用gzip,所以go这边本身可以不用 /*r.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPaths([]string{