> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify-mintlify-add-hello-world-quickstart-48843.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` 的常见使用场景包括：

* 仅供内部使用的端点。
* 不再维护且无需纳入文档的弃用端点。
* 尚未准备好对外发布文档的 Beta 功能。

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

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

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

```json {11, 19}
"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}
"webhooks": {
  "/plants_hook": {
    "post": {
      "description": "在商店新增植物时发送信息的 Webhook",
    }
  },
  "/hidden_plants_hook": {
    "post": {
      "x-hidden": true,
      "description": "在商店新增植物时发送部分保密信息的 Webhook",
    }
  },
  "/secret_plants_hook": {
    "post": {
      "x-excluded": true,
      "description": "在商店新增植物时发送绝密信息的 Webhook（请勿发布此端点！）"
    }
  }
}
```
