mirror of
https://github.com/mintlify/docs.git
synced 2026-09-14 13:35:46 +08:00
f4175ee8af
* docs: add related pages configuration and frontmatter * docs: translate related pages content to es, fr, zh * Apply suggestion from @ethanpalm * Apply suggestion from @ethanpalm * Apply suggestions from code review Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com> --------- Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com>
106 lines
3.7 KiB
Plaintext
106 lines
3.7 KiB
Plaintext
---
|
||
title: "相关页面"
|
||
description: "在每个页面底部显示“相关主题”部分,展示基于搜索的自动推荐或从 frontmatter 中手动整理的链接。"
|
||
keywords: ["相关", "相关页面", "相关主题", "推荐", "frontmatter"]
|
||
---
|
||
|
||
相关页面会在每个文档页面底部呈现一个 **相关主题** 部分,帮助读者发现相互关联的内容。推荐来源可以是基于搜索的自动建议,也可以是你在页面 frontmatter 中整理的链接,或两者的组合。
|
||
|
||
<div id="enable-related-pages">
|
||
## 启用相关页面
|
||
</div>
|
||
|
||
相关页面是一项部署 add-on。请在你的仪表盘中启用它:
|
||
|
||
1. 打开仪表盘并进入 **设置** > **Add-ons**。
|
||
2. 找到 **相关主题** 并将其开启。
|
||
3. 选择一种模式,并根据需要设置显示页面数量的上限。
|
||
|
||
<div id="modes">
|
||
## 模式
|
||
</div>
|
||
|
||
<ResponseField name="Automatic" type="mode">
|
||
基于当前页面的标题,从你文档的搜索索引中生成推荐。当页面中设置了 frontmatter 覆盖时,仍以 frontmatter 为准。当你希望相关页面在新增内容时自动更新时,请使用此模式。
|
||
</ResponseField>
|
||
|
||
<ResponseField name="Manual" type="mode">
|
||
仅显示页面 `related` frontmatter 中列出的页面。没有 `related` 字段的页面不会显示 **相关主题** 部分。当你希望完全掌控编辑内容时,请使用此模式。
|
||
</ResponseField>
|
||
|
||
<div id="limit">
|
||
### 数量上限
|
||
</div>
|
||
|
||
设置要显示的相关页面数量。默认值为 `5`,最大值为 `10`。该上限适用于自动推荐;手动条目也以最大值为上限。
|
||
|
||
<div id="configure-per-page-with-frontmatter">
|
||
## 通过 frontmatter 按页配置
|
||
</div>
|
||
|
||
使用 `related` frontmatter 字段可以覆盖或直接为某个页面提供相关页面列表。此字段在 **Automatic** 和 **Manual** 两种模式下均可使用。
|
||
|
||
<ResponseField name="related" type="array | false">
|
||
相关页面列表,或设为 `false` 以隐藏该页面的 **相关主题** 部分。
|
||
|
||
每个条目可以是:
|
||
- 指向文档中另一个页面的根相对路径:`/api-playground/overview`
|
||
- 指向外部站点的绝对 URL:`https://example.com/docs`
|
||
- 用于设置显式标签的 `Title: link` 对象
|
||
|
||
当未显式设置时,内部路径的标题和图标会从你的导航中推断得到。外部链接会在新标签页中打开。
|
||
</ResponseField>
|
||
|
||
<div id="examples">
|
||
### 示例
|
||
</div>
|
||
|
||
整理一组内部页面:
|
||
|
||
```mdx
|
||
---
|
||
title: "Authentication"
|
||
related:
|
||
- /api-playground/overview
|
||
- /deploy/authentication-setup
|
||
- /organize/hidden-pages
|
||
---
|
||
```
|
||
|
||
混合使用内部页面、外部链接和自定义标题:
|
||
|
||
```mdx
|
||
---
|
||
title: "Authentication"
|
||
related:
|
||
- Overview: /api-playground/overview
|
||
- Set up auth: /deploy/authentication-setup
|
||
- OAuth 2.0 spec: https://oauth.net/2/
|
||
---
|
||
```
|
||
|
||
在特定页面上隐藏 **相关主题** 部分:
|
||
|
||
```mdx
|
||
---
|
||
title: "Changelog"
|
||
related: false
|
||
---
|
||
```
|
||
|
||
<div id="how-suggestions-are-generated">
|
||
## 推荐是如何生成的
|
||
</div>
|
||
|
||
在 **Automatic** 模式下,相关页面基于你文档的搜索索引,将当前页面的标题作为查询条件生成。结果会按照页面的语言和版本(如适用)进行过滤,且会排除当前页面。
|
||
|
||
对于启用了[终端用户认证](/zh/deploy/authentication-setup)的部署,自动推荐会被禁用,以避免跨用户上下文泄露内容。在启用了用户认证的部署上,请使用 `related` frontmatter 字段来展示经过整理的推荐。
|
||
|
||
<div id="related-resources">
|
||
## 相关资源
|
||
</div>
|
||
|
||
- [页面](/zh/organize/pages):使用 frontmatter 配置页面元数据。
|
||
- [链接](/zh/guides/linking):连接页面的最佳实践。
|
||
- [搜索](/zh/optimize/search):配置搜索结果的排序和过滤方式。
|