浏览器登录改为 DB sessions(可吊销);敏感词与 OIDC PEM 入 settings; 落地安装向导、注册发帖与 /admin 仪表盘/板块/审核/设置。 Co-authored-by: Cursor <cursoragent@cursor.com>
15 lines
726 B
Plaintext
15 lines
726 B
Plaintext
---
|
||
description: Go HTML 模板约定(SSR)
|
||
globs: templates/**/*
|
||
alwaysApply: false
|
||
---
|
||
|
||
# 模板约定
|
||
|
||
- 目录对齐 Gitea:`templates/base/`、`home/`、`post/`、`shared/`、`status/`、`auth/`,根级 `install.tmpl` / `post-install.tmpl`。
|
||
- 页面入口用固定 `{{define "home"}}` / `{{define "post"}}` 等显式 `{{template "base/head"}}`…;**禁止** `{{template .Name}}`(标准库不支持动态名)。
|
||
- **默认转义**;用户 HTML 须先消毒 + 门控后再 `{{safeHTML ...}}`。
|
||
- 静态资源 `/ssr-assets/...`。
|
||
- 浏览器写操作走 `routers/web` 表单 POST + CSRF(`webctx`),不依赖 JSON `/api`。
|
||
- 中文文案可写在模板;站点名等从 PageChrome / settings 传入。
|