Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@

## [Unreleased]

### Fixed / Changed

- `references/template-variables.md`:补齐与 Gridea Pro 真实运行时之间的多处差距:
- **Post 对象**:补 `id` / `abstract` / `description` / `toc` / `categories` / `tagsString` / `stats` / `prevPost` / `nextPost` / `createdAt` / `updatedAt` / `updatedAtFormat` / `published`;
- **修正旧文档错误**:`post.date` 实际是 `time.Time`(不是字符串),展示日期首选 `post.dateFormat`;
- **新增对象章节**:`Category` / `PostStats` / `SimplePostView`(prevPost / nextPost 的元素类型);
- **Tag 对象**:补 `slug` / `usedName`;**Memo 对象**:补 `id` / `tags` / `createdAt` / `createdAtISO` / `dateFormat`;
- **Pagination**:补 `currentPage` / `totalPages` / `totalPosts` / `hasPrev` / `hasNext` / `prevURL` / `nextURL`,并保留 `prev` / `next` 兼容字段;
- **全局变量表**:补 `category` / `current_tag`(别名) / `archives` / `links` / `commentSetting` / `site`(`config` 别名);
- **新增页面 `category.html`**:每个分类一份,由引擎 `RenderCategoryPages` 自动渲染到 `/category/<slug>/`;同时澄清「**没有 `categories.html`**」——引擎不暴露全站分类索引页和 `categories` 全局数组,要做总览得自己从 `posts[].categories` 聚合;
- **新增章节《引擎自动生成的输出》**:列出 `/api/search.json`(schema:`[{title, link, date, tags, content}]`,content 已脱 HTML)/ `/feed.xml` / `/atom.xml` / `/sitemap.xml` / `/robots.txt` / `/manifest.json`,以及客户端 fetch 示例;
- **上下篇导航语义警示**:`prevPost` 在 Gridea Pro 里实际是数组前一项(更新的一篇),与 Hexo / Hugo 习惯相反;从其他生态移植主题时不能照搬「上一篇 = 更早」的标签。
- `assets/mock-data.json`:首篇 mock 文章补 `id` / `abstract` / `description` / `toc` / `categories` / `stats` / `prevPost` / `nextPost` / `createdAt` / `updatedAt` 等新字段;新增 `category` 全局对象供 `category.html` 渲染;标签补 `slug`。
- `scripts/render_test.py`:补 `category.html` 模板的 context 构建分支(注入 `category` + 按 `post.categories` 过滤 posts),与真实运行时对齐。

## [0.1.0] - 2026-04-14

### Added
Expand Down
32 changes: 30 additions & 2 deletions assets/mock-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,36 @@
],
"posts": [
{
"id": "post-001",
"title": "Gridea Pro 主题开发完全指南",
"content": "<h2>前言</h2><p>这是一篇完整的测试文章,包含各种 Markdown 元素。</p><h3>代码块</h3><pre><code class=\"language-javascript\">console.log('Hello World');\nconst x = 42;</code></pre><h3>列表</h3><ul><li>项目一</li><li>项目二</li></ul><ol><li>有序一</li><li>有序二</li></ol><blockquote><p>这是引用文字</p></blockquote><p>包含<strong>加粗</strong>、<em>斜体</em>、<code>行内代码</code>和<a href=\"https://example.com\">链接</a>。</p><table><thead><tr><th>名称</th><th>类型</th></tr></thead><tbody><tr><td>标题</td><td>字符串</td></tr></tbody></table><p><img src=\"/post-images/test.jpg\" alt=\"测试图片\"></p><hr>",
"abstract": "<p>这是一篇完整的测试文章,包含各种 Markdown 元素。</p>",
"description": "这是一篇完整的测试文章,包含各种 Markdown 元素。",
"toc": "<ol><li><a href=\"#前言\">前言</a><ol><li><a href=\"#代码块\">代码块</a></li><li><a href=\"#列表\">列表</a></li></ol></li></ol>",
"date": "2026-02-28",
"dateFormat": "2026年02月28日",
"createdAt": "2026-02-28",
"updatedAt": "2026-02-28",
"updatedAtFormat": "2026年02月28日",
"published": true,
"link": "/post/gridea-pro-theme-guide/",
"tags": [
{"name": "教程", "link": "/tag/tutorial/", "count": 3},
{"name": "Gridea", "link": "/tag/gridea/", "count": 5}
{"name": "教程", "slug": "tutorial", "link": "/tag/tutorial/", "count": 3},
{"name": "Gridea", "slug": "gridea", "link": "/tag/gridea/", "count": 5}
],
"tagsString": "教程,Gridea",
"categories": [
{"name": "前端", "slug": "frontend", "link": "/category/frontend/", "count": 2}
],
"feature": "/post-images/guide-cover.jpg",
"stats": {"words": 1234, "minutes": 5, "text": "5 min read"},
"prevPost": null,
"nextPost": {
"title": "没有封面图和标签的文章",
"link": "/post/no-cover-no-tags/",
"fileName": "no-cover-no-tags",
"feature": ""
},
"isTop": true,
"hideInList": false,
"fileName": "gridea-pro-theme-guide"
Expand Down Expand Up @@ -215,14 +235,22 @@
},
"tag": {
"name": "教程",
"slug": "tutorial",
"link": "/tag/tutorial/",
"count": 3
},
"current_tag": {
"name": "教程",
"slug": "tutorial",
"link": "/tag/tutorial/",
"count": 3
},
"category": {
"name": "前端",
"slug": "frontend",
"link": "/category/frontend/",
"count": 2
},
"post": null,
"links": [
{
Expand Down
Loading