fesiong/anqicms/template-dev
Claude Code and agent skill by fesiong/anqicms
- community
Checking that the SKILL.md file is still in the repository.
AnQiCMS 模板开发技能:基于 pongo2(Django 语法)的自定义模板引擎,标签闭合规则完整速查
Install
npx vskill@latest install fesiong/anqicms/template-devSKILL.md
AnQiCMS 模板开发技能
AnQiCMS 使用基于 github.com/flosch/pongo2(Django-like syntax)的模板引擎,并在此基础上做了自定义扩充。
核心语法
- 变量:
{{ item.Title }}— 严格区分大小写,字段首字母大写 - 过滤器:
{{ var|filter }} - 注释:
{# 单行 #}或{% comment %}...{% endcomment %} - 时间格式:使用 Golang 参考时间
2006-01-02 15:04:05 - 函数:
{{ stampToDate(timestamp, "2006-01-02") }} - 过滤器:
{{ timestamp|dateFormat:"2006-01-02" }} - 空值判断:
{% if array %}或{% for %}...{% empty %}...{% endfor %} - 条件:
{% if cond %}...{% elif %}...{% else %}...{% endif %}(用elif不是elseif) - 变量声明:用标签获取数据时需声明变量名才能后续引用
标签闭合规则
并非所有标签都需要闭合。 以下按类型区分。
需闭合标签(BLOCK_TAGS)
这些标签必须成对使用:{% tag %}...{% endtag %}`
| 标签 | 闭合 | 用途 | |
|---|---|---|---|
archiveList | endarchiveList | 文档列表 | |
categoryList | endcategoryList | 分类列表 | |
navList | endnavList | 导航 | |
pagination | endpagination | 分页 | |
tagList | endtagList | 标签列表 | |
bannerList | endbannerList | 横幅 | |
commentList | endcommentList | 评论列表 | |
guestbookList | endguestbookList | 留言列表 | |
placeList | endplaceList | 推荐位列表 | |
if | endif | 条件判断 | |
for | endfor | 循环 | |
block | endblock | 模板块 | |
with | endwith | 局部变量 | |
autoescape | endautoescape | 转义控制 | |
filter | endfilter | 过滤器块 | |
ifchanged | endifchanged | 分组变化 | |
ifequal | endifequal | 相等判断 | |
ifnotequal | endifnotequal | 不等判断 | |
macro | endmacro | 宏 | |
spaceless | endspaceless | 空白压缩 | |
pageList | endpageList | 页面列表 | |
prevArchive | endprevArchive | 上一篇 | |
nextArchive | endnextArchive | 下一篇 | |
breadcrumb | endbreadcrumb | 面包屑 | |
linkList | endlinkList | 友情链接 | |
guestbook | endguestbook | 留言板 | |
archiveParams | endarchiveParams | 文档参数 | |
tagDataList | endtagDataList | 标签文档列表 | |
archiveFilters | endarchiveFilters | 筛选器 | |
languages | endLanguages(或 endlanguages) | 多语言切换 | |
jsonLd | endjsonLd | 结构化数据 | |
comment | endcomment | 多行注释 |
自闭合标签(SINGLE_TAGS)
这些标签不需要闭合,单行使用即可:
archiveDetail · categoryDetail · tagDetail · pageDetail · moduleDetail · placeDetail · userDetail · userGroupDetail · tdk · system · contact · diy · tr · lorem · now · set · include · extends · import · ssi · templatetag · widthratio · attachment · cycle · firstof · jump
控制标签(CONTROL_TAGS)
这些标签必须出现在特定的块标签内部:
| 标签 | 必须位于 | 说明 | |
|---|---|---|---|
{% else %} | {% if %}...{% endif %} 内部 | 条件分支 | |
{% elif %} | {% if %}...{% endif %} 内部 | 多条件 | |
{% empty %} | {% for %}...{% endfor %} 内部 | 空数据提示 |
常用标签速查
内容获取
| 标签 | 关键参数 | |
|---|---|---|
archiveList | moduleId(1=文章,2=产品), categoryId, flag(c/h/f), limit, order, type | |
archiveDetail | id 或 url_token | |
categoryList | type=list/tree, moduleId | |
tagDataList | tagId | |
archiveFilters | moduleId, allText |
页面组件
逻辑控制
过滤器与函数
全局函数(AddFunc 注册,用 {{ fn(args) }} 调用):stampToDate · priceFormat · range · CustomFunc
- 时间:
{{ stampToDate(timestamp, "2006-01-02") }} - 价格:
{{ priceFormat(price) }}
AnQiCMS 自定义过滤器(tags/filter.go,用 {{ var|filter }}): thumb(缩略图)· render(渲染模板片段)· json(转 JSON)· lazy(懒加载占位)· dump · contain · fields · index · repeat · list · count · trim · trimLeft · trimRight · replace · dateFormat · priceFormat;另替换了内置的 split、wordwrap。
- 时间过滤器:
{{ timestamp|dateFormat:"2006-01-02" }} - 价格过滤器:
{{ price|priceFormat }}
pongo2 内置过滤器:default · length · upper · lower · title · urlencode · addslashes · slugify · first · last · cut · center · wordcount · random 等。
注意:stampToDate是全局函数不是过滤器,写成{{ stampToDate(x, "2006-01-02") }};对应的时间过滤器是dateFormat。
验证清单
- [ ] 字段首字母大写(
Title不是title,Link不是link) - [ ] 需闭合的标签正确成对(见上方 BLOCK_TAGS 表)
- [ ] 自闭合标签没有错误添加
end前缀 - [ ]
elif不是elseif - [ ] 时间用
stampToDate函数或dateFormat过滤器 - [ ] 模板目录结构遵循标准布局(
base.html+ 模型目录) - [ ] 修改后调用
system_config(action=template_reload)生效
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingprovider/seeds/skills/template-dev/SKILL.md
Popularity
- Repository stars
- 559
- Repository forks
- 139
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/fesiong/anqicms/template-dev)