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

118 lines
4.0 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
---
```
<Note>
搜索引擎无法对隐藏页面进行索引编入。设置 `hidden: true` 时,该页面会自动从搜索引擎索引编入、站点地图和 AI 上下文中排除。但是,设置 `noindex: true` 并**不会**将页面从导航中隐藏。有关更多信息,请参阅[禁用索引编入](/zh/optimize/seo#disable-indexing)。
</Note>
<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"
}
```
<div id="understanding-hidden-versus-noindex">
### 理解 `hidden` 与 `noindex` 的区别
</div>
`hidden` 和 `noindex` 之间的关系是单向的:
* **`hidden: true` → 会自动应用 `noindex`**:隐藏页面会自动从搜索引擎、站点地图和 AI context 中排除在外。
* **`noindex: true` → 不会应用 `hidden`**:带有 `noindex: true` 的页面在导航中仍然可见。它们只会影响搜索引擎索引和 AI context。
如果想让某个页面从搜索引擎中排除,但仍在导航中可见,请在它的 frontmatter 中添加 `noindex: true`。如果想让页面同时从导航和搜索引擎中隐藏,请使用 `hidden: true`。