mirror of
https://github.com/mintlify/docs.git
synced 2026-09-14 13:35:46 +08:00
43e52a0f75
* Add Chinese translations for settings sub-pages Generated-By: mintlify-agent * Apply suggestion from @ethanpalm --------- Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com>
116 lines
2.7 KiB
Plaintext
116 lines
2.7 KiB
Plaintext
---
|
||
title: "SEO 和搜索"
|
||
description: "在 `docs.json` 中配置站点描述、索引、meta 标签、搜索栏文本和页面时间戳。"
|
||
keywords: ["SEO", "搜索", "索引", "meta 标签", "描述", "时间戳", "最后修改", "docs.json"]
|
||
---
|
||
|
||
使用 `docs.json` 文件中的这些设置来控制搜索引擎如何索引你的文档、搜索结果中显示的元数据、搜索栏的行为,以及页面是否显示最后修改时间戳。
|
||
|
||
## 设置
|
||
|
||
### `description`
|
||
|
||
**类型:** `string`
|
||
|
||
文档站点的描述,用于 SEO 和 AI 索引。它会出现在搜索引擎结果中,AI 工具使用它来理解你站点的用途。
|
||
|
||
```json docs.json
|
||
"description": "Example Co. API 和开发者平台的文档。"
|
||
```
|
||
|
||
---
|
||
|
||
### `seo`
|
||
|
||
**类型:** `object`
|
||
|
||
搜索引擎索引和元数据设置。
|
||
|
||
<ResponseField name="seo.indexing" type='"navigable" | "all"'>
|
||
指定搜索引擎应索引哪些页面。
|
||
|
||
- `navigable` — 仅索引包含在 `docs.json` 导航中的页面。默认为此值。
|
||
- `all` — 索引项目中的每个页面,包括不在导航中的页面。
|
||
</ResponseField>
|
||
|
||
<ResponseField name="seo.metatags" type="object">
|
||
添加到每个页面的自定义 meta 标签。以键值对形式提供,其中每个键是 meta 标签名称,值是其内容。
|
||
|
||
有关可用选项,请参阅[常见 meta 标签参考](/zh/optimize/seo#common-meta-tags-reference)。
|
||
|
||
```json
|
||
"metatags": {
|
||
"og:site_name": "Example Co. Docs",
|
||
"twitter:card": "summary_large_image"
|
||
}
|
||
```
|
||
</ResponseField>
|
||
|
||
```json docs.json
|
||
"seo": {
|
||
"indexing": "navigable",
|
||
"metatags": {
|
||
"og:site_name": "Example Co. Docs"
|
||
}
|
||
}
|
||
```
|
||
|
||
---
|
||
|
||
### `search`
|
||
|
||
**类型:** `object`
|
||
|
||
搜索栏显示设置。
|
||
|
||
<ResponseField name="search.prompt" type="string">
|
||
搜索栏为空时显示的占位符文本。
|
||
</ResponseField>
|
||
|
||
```json docs.json
|
||
"search": {
|
||
"prompt": "搜索文档..."
|
||
}
|
||
```
|
||
|
||
---
|
||
|
||
### `metadata`
|
||
|
||
**类型:** `object`
|
||
|
||
全局应用于所有页面的页面级元数据设置。
|
||
|
||
<ResponseField name="metadata.timestamp" type="boolean">
|
||
在所有页面上显示最后修改日期。启用后,每个页面都会显示其内容最后修改的日期。默认为 `false`。
|
||
|
||
你可以使用 `timestamp` frontmatter 字段为单个页面覆盖此设置。详情请参阅[页面](/zh/organize/pages#last-modified-timestamp)。
|
||
</ResponseField>
|
||
|
||
```json docs.json
|
||
"metadata": {
|
||
"timestamp": true
|
||
}
|
||
```
|
||
|
||
## 示例
|
||
|
||
```json docs.json
|
||
{
|
||
"description": "Example Co. API 和开发者平台的文档。",
|
||
"seo": {
|
||
"indexing": "navigable",
|
||
"metatags": {
|
||
"og:site_name": "Example Co. Docs",
|
||
"twitter:card": "summary_large_image"
|
||
}
|
||
},
|
||
"search": {
|
||
"prompt": "搜索文档..."
|
||
},
|
||
"metadata": {
|
||
"timestamp": true
|
||
}
|
||
}
|
||
```
|