Skip to content

Commit

Permalink
docs: add docs for getBreadcrumbs of category finder (#384)
Browse files Browse the repository at this point in the history
### What this PR does?
为分类 Finder API 新增的 getBreadcrumbs 方法提供文档

see also halo-dev/halo#6135

```release-note
None
```
  • Loading branch information
guqing committed Jul 4, 2024
1 parent bf152a8 commit c565125
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/developer-guide/theme/finder-apis/category.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,35 @@ List<[#CategoryTreeVo](#categorytreevo)>
</ul>
```

## getBreadcrumbs(name)

```js
categoryFinder.getBreadcrumbs('category-foo')
```

### 描述

获取分类树结构的路径节点,可以通过此方法来构建面包屑导航。

### 参数

- `name:string` - 分类的唯一标识 `metadata.name`,必填。

### 返回值

List<[#CategoryVo](#categoryvo)>

### 示例

```html
<div>
<th:block th:each="category,stats : ${categoryFinder.getBreadcrumbs(category.metadata?.name)}">
<a th:href="@{${category.status.permalink}}" th:text="${category.spec.displayName}"></a>
<span th:if="${!stats.last}">/</span>
</th:block>
</div>
```

## 类型定义

### CategoryVo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,35 @@ List<[#CategoryTreeVo](#categorytreevo)>
</ul>
```

## getBreadcrumbs(name)

```js
categoryFinder.getBreadcrumbs('category-foo')
```

### 描述

获取分类树结构的路径节点,可以通过此方法来构建面包屑导航。

### 参数

- `name:string` - 分类的唯一标识 `metadata.name`,必填。

### 返回值

List<[#CategoryVo](#categoryvo)>

### 示例

```html
<div>
<th:block th:each="category,stats : ${categoryFinder.getBreadcrumbs(category.metadata?.name)}">
<a th:href="@{${category.status.permalink}}" th:text="${category.spec.displayName}"></a>
<span th:if="${!stats.last}">/</span>
</th:block>
</div>
```

## 类型定义

### CategoryVo
Expand Down

0 comments on commit c565125

Please sign in to comment.