From 654752541a9ab6e6f9fd7c1bde9938bcaace6127 Mon Sep 17 00:00:00 2001 From: John Niang Date: Sat, 20 Dec 2025 12:34:13 +0800 Subject: [PATCH] Enhance cursor method documentation with additional info and clarify return types (#533) * Enhance cursor method documentation with additional info and clarify return types * Update API changelog to include changes to cursor(postName) return structure --- docs/developer-guide/theme/api-changelog.md | 4 ++++ docs/developer-guide/theme/finder-apis/post.md | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/developer-guide/theme/api-changelog.md b/docs/developer-guide/theme/api-changelog.md index 3fb6df8..d59e928 100644 --- a/docs/developer-guide/theme/api-changelog.md +++ b/docs/developer-guide/theme/api-changelog.md @@ -12,3 +12,7 @@ description: 记录每一个版本的主题 API 变更记录,方便开发者 ### 表单定义 > 新增 `array` 组件 在 2.22.0 中,我们为 FormKit 表单新增了 `array` 组件,用于定义一组数据,并计划使用 `array` 组件替换原有的 `repeater` 组件。详细文档可查阅:[表单定义#array](../../developer-guide/form-schema.md#array) + +### 文章 Finder API > 修改 `cursor(postName)` 返回结构 + +我们修改了文章 Finder API 中 `cursor(postName)` 方法的返回体结构,移除了 `current` 字段,并修改了 `previous` 和 `next` 字段类型为 `ListedPostVo`,并明确了上一篇文章是指发布时间较当前文章更早的文章,下一篇文章是指发布时间较当前文章更新的文章。详细文档可查阅:[文章 Finder API#cursor](../../developer-guide/theme/finder-apis/post.md#cursor)。 diff --git a/docs/developer-guide/theme/finder-apis/post.md b/docs/developer-guide/theme/finder-apis/post.md index 0e53cfd..2510ac2 100644 --- a/docs/developer-guide/theme/finder-apis/post.md +++ b/docs/developer-guide/theme/finder-apis/post.md @@ -72,6 +72,10 @@ postFinder.cursor(postName); 根据文章的 `metadata.name` 获取相邻的文章(上一篇 / 下一篇)。 +:::info 提示 +上一篇文章是指发布时间较当前文章更早的文章,下一篇文章是指发布时间较当前文章更新的文章。 +::: + ### 参数 1. `postName:string` - 文章的唯一标识 `metadata.name`。 @@ -448,9 +452,8 @@ postFinder.archives(page, size, year, month); ```json title="NavigationPostVo" { - "previous": "#PostVo", // 上一篇文章 - "current": "#PostVo", // 当前文章 - "next": "#PostVo" // 下一篇文章 + "previous": "#ListedPostVo", // 上一篇文章,发布时间较当前文章更早的文章 + "next": "#ListedPostVo" // 下一篇文章,发布时间较当前文章更新的文章 } ```