fix templates v2

This commit is contained in:
tamakyi
2026-10-22 17:49:25 +08:00
parent bd02eb7ed2
commit b939d26ff0
11 changed files with 436 additions and 60 deletions
+3 -2
View File
@@ -67,8 +67,9 @@ func FuncMap() []template.FuncMap {
},
// announcement 返回当前应展示的公告(已转义的安全 HTML),窗口外返回空串。
// 时间窗判定放在服务端:不依赖访客时钟,也不会先渲染出来再被脚本抹掉。
"announcement": func() template.HTML {
content, ok := conf.Announcement.Active(time.Now())
// 按访客语言取文案,未翻译的语言回退到 content。
"announcement": func(lang string) template.HTML {
content, ok := conf.Announcement.Active(time.Now(), lang)
if !ok {
return ""
}