跳转到内容
本站为社区维护的非官方中文翻译,与 Cloudflare, Inc. 无关联。本站不提供账户登录,请勿在任何非官方站点输入您的 Cloudflare 账户信息。官方文档:developers.cloudflare.com

前置元数据

最后更新 查看 MarkdownAgent 设置

Frontmatter 包含页面的元数据,例如 title。它以 YAML 格式编写,位于页面顶部的 --- 之间。

例如:

---
title: Create a Cloudflare Tunnel
pcx_content_type: how-to
products:
  - cloudflare-tunnel
description: Set the required and optional frontmatter fields that carry a page's metadata, such as title, description, and pcx_content_type.
sidebar:
  order: 2
---

有关可用字段的更多信息,请参阅 Nimbus 文档 ↗。

必需字段

每个带有 pcx_content_type 的页面必须包含:

字段 描述
title 页面标题。纯文本。
pcx_content_type 页面的内容类型。请参阅内容类型。
description 用于 <meta name="description"> 标签的 1-2 句摘要。请参阅编写描述。

编写描述

description 字段会填充 HTML 头部中的 <meta name="description"> 标签。对于搜索引擎、AI 爬虫和 llms.txt 消费者在决定是否展示或引用某个页面时,这是唯一且最重要的元数据字段。

一个优秀的描述:

  • 由 1-2 句独立完整的句子组成(目标字数为 50-160 个字符/汉字)。
  • 指明产品或功能名称。
  • 说明该页面如何帮助读者操作或理解。
  • 从页面中提取出来时,可以作为一个独立的答案片段。

不要以诸如 “This page describes...”(本页描述了...)、“Learn more about...”(了解更多关于...)或 “This document explains...”(本文档解释了...)之类的通用开头词起笔。这些会浪费最宝贵的元数据空间,且没有增加任何实质性信息。

现有的 summary 字段对于页面上的体验仍然有用,但对于 AI 和搜索目的而言,它是次于 description 的。

示例

Weak description (generic, not extractable)yaml
description: Set the required and optional frontmatter fields that carry a page's metadata, such as title, description, and pcx_content_type.
Strong description (self-contained, citable)yaml
description: Set the required and optional frontmatter fields that carry a page's metadata, such as title, description, and pcx_content_type.
Weak description (repeats title)yaml
description: Set the required and optional frontmatter fields that carry a page's metadata, such as title, description, and pcx_content_type.
Strong description (adds value beyond the title)yaml
description: Set the required and optional frontmatter fields that carry a page's metadata, such as title, description, and pcx_content_type.

可选字段

有关 sidebar、tags、products、difficulty 和 reviewed 等可选字段,请参阅自定义属性。

有关可用字段的更多信息,请参阅 Nimbus 文档 ↗。

这篇文档对您有帮助吗?