> ## Documentation Index
> Fetch the complete documentation index at: https://omer-914cc1c6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 管理页面可见性

> 控制 OpenAPI 规范中的哪些端点显示在文档导航中

你可以控制哪些 OpenAPI 操作会发布为文档页面，以及它们在导航中的显示方式。这对于仅供内部使用的端点、已废弃的操作、测试版功能，或需要通过直接 URL 访问但不应通过站点导航被发现的端点非常有用。

如果你的页面是从 OpenAPI 文档自动生成的，你可以使用 `x-hidden` 和 `x-excluded` 扩展来管理页面可见性。

<div id="x-hidden">
  ## `x-hidden`
</div>

`x-hidden` 扩展会为某个端点创建页面，但会在导航中将其隐藏。该页面只能通过直接访问其 URL 打开。

`x-hidden` 的常见用例包括：

* 需要编写文档但不希望在导航中推广的端点。
* 将从其他内容中链接到的页面。
* 面向特定用户的端点。

<div id="x-excluded">
  ## `x-excluded`
</div>

`x-excluded` 扩展会将某个端点从文档中完全排除。

`x-excluded` 的常见用例包括：

* 仅供内部使用的端点。
* 已废弃但不希望在文档中保留的端点。
* 尚未准备好公开发布文档的测试版功能。

<div id="implementation">
  ## 实现
</div>

在 OpenAPI 规范中，将 `x-hidden` 或 `x-excluded` 扩展添加到相应的 HTTP 方法下。

下面是一些示例，展示如何在 OpenAPI 架构文档中为某个 endpoint 和 webhook 路径使用这些属性。

```json {11, 19} theme={null}
"paths": {
  "/plants": {
    "get": {
      "description": "返回商店中的所有植物",
      "parameters": { /*...*/ },
      "responses": { /*...*/ }
    }
  },
  "/hidden_plants": {
    "get": {
      "x-hidden": true,
      "description": "返回商店中的所有半秘密植物",
      "parameters": { /*...*/ },
      "responses": { /*...*/ }
    }
  },
  "/secret_plants": {
    "get": {
      "x-excluded": true,
      "description": "返回商店中的所有绝密植物（请勿发布此端点！）",
      "parameters": { /*...*/ },
      "responses": { /*...*/ }
    }
  }
},
```

```json {9, 15} theme={null}
"webhooks": {
  "/plants_hook": {
    "post": {
      "description": "新植物添加到商店时的 Webhook 信息",
    }
  },
  "/hidden_plants_hook": {
    "post": {
      "x-hidden": true,
      "description": "新植物添加到商店时的机密信息 Webhook"
    }
  },
  "/secret_plants_hook": {
    "post": {
      "x-excluded": true,
      "description": "新植物添加到商店时的绝密信息 Webhook（请勿发布此端点！）"
    }
  }
}
```
