Yoast Seo
import YoastSchemaExample from '../../../../src/components/YoastSchemaExample';
本页面记录了 Yoast SEO 插件输出的 schema.org 标记。更多关于我们的 API、集成机制和方法论的信息,请参阅概述。
核心逻辑
每个页面都应(尝试)输出以下片段:
这将生成一个“基础脚本”,通常类似于以下内容(上述片段的组合):
{`{ "@context": "https://schema.org", "@graph": [ { "@type": "Organization", "@id": "https://www.example.com/#/schema/organization/1", "url": "https://www.example.com/#/schema/organization/", "name": "Example organization name", "sameAs": [ "https://www.wikipedia.com/example-organization", "https://www.linkedin.com/company/1234" ], "logo": { "@id": "https://www.example.com/#/schema/image/abc123" }, "image": [ { "@id": "https://www.example.com/#/schema/image/abc123" }, { "@id": "https://www.example.com/#/schema/image/def456" } ] }, { "@type": "WebSite", "@id": "https://www.example.com/#/schema/website/1", "url": "https://www.example.com/", "name": "Example website", "potentialAction": { "@type": "SearchAction", "target": "https://www.example.com/?s={search_term_string}", "query-input": "required name=search_term_string" }, "publisher": { "@id": "https://www.example.com/#/schema/organization/1" } }, { "@type": "WebPage", "@id": "https://www.example.com/example-page/test/", "url": "https://www.example.com/example-page/test/", "name": "Example page name", "description": "Example page description", "keywords": "cats,dogs,cake", "isPartOf": { "@id": "https://www.example.com/#/schema/website/1" }, "inLanguage": "en-US", "datePublished": "2019-07-10T08:08:40+00:00", "dateModified": "2019-07-10T08:43:03+00:00", "breadcrumb": { "@id": "https://www.example.com/example-page/#/schema/breadcrumb/abc123" }, "image": [ { "@id": "https://www.example.com/#/schema/image/abc123" }, { "@id": "https://www.example.com/#/schema/image/def456" } ] }, { "@type": "BreadcrumbList", "@id": "https://www.example.com/example-page/#/schema/breadcrumb/abc123", "itemListElement": [ { "@type": "ListItem", "position": 1, "item": { "@type": "WebPage", "@id": "https://www.example.com/", "url": "https://www.example.com/", "name": "Home" } }, { "@type": "ListItem", "position": 2, "item": { "@id": "https://www.example.com/example-page/test/" } } ] }, { "@type": "ImageObject", "@id": "https://www.example.com/#/schema/image/abc123", "url": "https://www.example.com/uploads/example-image.jpg", "caption": "Example caption", "width": 120, "height": 120 }, { "@type": "ImageObject", "@id": "https://www.example.com/#/schema/image/def456", "url": "https://www.example.com/uploads/example-image.jpg", "caption": "Example caption", "width": 120, "height": 120 } ] }`}其他场景
在以下场景中,上述基础脚本应进行修改或扩展。
当网站代表个人时
- 向
Organization添加一个额外的@type值Person。 - 将
Person的属性合并到Organization的属性中。
针对单篇文章
- 添加一个文章片段,并将其连接到
WebPage(通过mainEntityOfPage属性)。
当页面包含 HowTo 块时
- 添加一个HowTo片段,并将其连接到
WebPage——或者,如果存在Article,则连接到Article(通过mainEntityOfPage属性)。
当页面包含常见问题解答区块时
- 向
WebPage额外添加一个@type值为FAQPage - 向
WebPage添加mainEntity属性,引用每个question节点的 ID(以数组形式)
更多信息
这篇文档对你有帮助吗?
谢谢你的反馈!