schema.org - mainEntityOfPage 模式的正确用法是什么
问题描述
我正在为杂志编写结构化数据。我在文章类型下得到了这个:
"mainEntityOfPage": {
"@type": "WebPage",
"@id": " https://www.example.com/category" //category of the article
},
我想我会用这个标记文章的类别。这是正确的使用方法mainEntityOfPage
吗?
解决方案
不,该值应该是WebPage
专用于Article
. 这两个项目通常具有相同url
但可能不同的@id
值(请参阅页面的 URL 与 post)。
{
"@context": "http://schema.org",
"@type": "Article",
"@id": "/articles/42#this",
"url": "/articles/42",
"mainEntityOfPage": {
"@type": "ItemPage",
"@id": "/articles/42",
"url": "/articles/42"
}
}
查看逆属性时可能会变得更清楚mainEntity
。您将有一个WebPage
当前页面并提供mainEntity
属性来传达此页面上的主要实体是什么:
{
"@context": "http://schema.org",
"@type": "ItemPage",
"mainEntity": {
"@type": "Article"
}
}
使用mainEntityOfPage
代替时mainEntity
,您只需切换主语和宾语。
推荐阅读
- reactjs - 如何从 .next 文件夹开始我的项目?
- f# - 转换基于 DU 的 AST 的 F# 函数式方法
- git - 如何确定合并是否添加了新信息
- tableau-api - Tableau - 返回具有最大值的列名称
- css - CSS Line 围绕垂直方向的文本
- powerbi - Power BI DAX 无法在矩阵视觉对象中显示正确的去年月度数据
- kubernetes - 如何在 Kubernetes 集群上强制驱逐(minikube)
- php - PHPWord 可以处理来自字符串变量而不是文件的源数据吗?
- android - 如何解码和读取统一 udp 数据包?
- docker - 使用 docker/build-push-action 在 GitHub Actions 中本地构建 docker 映像