🐛 fix(template): 自定义CSS

This commit is contained in:
naiba 2020-12-20 22:09:53 +08:00
parent 8323a26bad
commit fb770573d5
3 changed files with 4 additions and 4 deletions

View File

@ -25,8 +25,8 @@ func ServeWeb(port uint) {
"tf": func(t time.Time) string {
return t.Format("2006年1月2号")
},
"css": func(s string) template.CSS {
return template.CSS(s)
"safe": func(s string) template.HTML {
return template.HTML(s)
},
"tag": func(s string) template.HTML {
return template.HTML(`<` + s + `>`)

View File

@ -2,7 +2,7 @@
{{template "common/header" .}}
{{if ts .CustomCSS}}
{{tag "style"}}
{{.CustomCSS|css}}
{{.CustomCSS|safe}}
{{tag "/style"}}
{{end}}
{{template "common/menu" .}}

View File

@ -21,7 +21,7 @@
<link rel="stylesheet" href="/static/theme-hotaru/css/darkmode.css?v202012121912" type="text/css">
{{if ts .CustomCSS}}
{{tag "style"}}
{{.CustomCSS|css}}
{{.CustomCSS|safe}}
{{tag "/style"}}
{{end}}
</head>