Files
mintlify__docs/zh/organize/hidden-pages.mdx
locadex-agent[bot] b19f56de91 docs(locadex): add translations (#3378)
Co-authored-by: locadex-agent[bot] <217277504+locadex-agent[bot]@users.noreply.github.com>
2026-02-10 15:23:42 -08:00

108 lines
3.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "隐藏页面"
description: "将页面从导航中隐藏,同时保持可访问性。"
keywords: ["从导航中隐藏", "未列出", "页面可见性"]
---
隐藏页面不会出现在站点的导航中,但任何知道该 URL 的人仍然可以访问它们。比如,如果你创建了一个像 `guides/hidden-page.mdx` 这样的隐藏页面,访问者依然可以通过 `docs.yoursite.com/guides/hidden-page` 打开它。
当你希望用户能够访问某些内容,或将其作为 AI 工具的上下文引用,但又不希望这些内容出现在导航中时,可以使用隐藏页面。
如果你的内容需要严格的访问控制,必须配置[认证](/zh/deploy/authentication-setup)。
要将页面限制为特定用户组访问,请设置[基于用户组的访问控制](/zh/deploy/authentication-setup#control-access-with-groups)。
参见[隐藏页面示例](/zh/organize/hidden-page-example)。
<Note>
某些导航元素,如侧边栏、下拉菜单和选项卡,在隐藏页面上可能会显示为空或导致布局发生变化。
</Note>
<div id="hide-a-page">
## 隐藏页面
</div>
要隐藏页面,请在页面的 [frontmatter](/zh/organize/pages) 中设置 `hidden: true`,或将其从 `docs.json` 的 navigation 中移除。
<div id="set-hidden-true-in-frontmatter">
### 在 frontmatter 中设置 `hidden: true`
</div>
在页面的 frontmatter 中添加 `hidden: true`,可以将该页面从渲染的导航中移除,同时仍然将其包含在 `docs.json` 配置中。
```yaml
---
title: "My hidden page"
hidden: true
---
```
搜索引擎无法对设置了 `hidden: true` 的页面进行索引编入。有关更多信息,请参阅[禁用索引编入](/zh/optimize/seo#disabling-indexing)。
<div id="remove-the-page-from-navigation">
### 从导航中移除页面
</div>
如果你没有在 `docs.json` 的 navigation 中包含某个页面,该页面就会被隐藏。这种方式非常适合那些你根本不希望出现在导航中的页面。
<div id="hide-a-group-of-pages">
## 隐藏一组页面
</div>
若要隐藏一组页面,请在你的 `docs.json` 文件中将该页面分组的 `hidden` 属性设为 `true`:
```json highlight={4}
"groups": [
{
"group": "快速开始",
"hidden": true,
"pages": [
"index",
"quickstart"
]
},
{
"group": "Guides",
"pages": [
"guides/hidden-page.mdx",
"guides/hidden-groups.mdx"
]
}
]
```
在此示例中,`Getting started` 组被隐藏,并且 `Guides` 组可见。
<div id="hide-a-tab">
### 隐藏标签页
</div>
要隐藏某个标签页,请在 `docs.json` 文件中为该标签页添加 `hidden` 属性:
```json highlight={4}
"tabs": [
{
"tab": "首页",
"hidden": true,
"pages": [
"index",
"quickstart"
]
}
]
```
<div id="search-seo-and-ai-indexing">
## 搜索、SEO 与 AI 索引编入
</div>
默认情况下,隐藏页面不会被纳入搜索引擎的索引、文档站点的内部搜索,也不会作为 AI 助手的上下文使用。若要在搜索结果中包含隐藏页面并将其作为 AI 助手的上下文,请在你的 `docs.json` 中添加 `seo` 属性:
```json
"seo": {
"indexing": "all"
}
```
要排除某个特定页面,请在其 frontmatter 中添加 `noindex: true`。