我想添加谷歌的结构数据在WordPress博客文章,网页。我需要在哪里放置结构数据(在身体或头部部分)?什么是正确的架构结构的文章或网页?
谢谢
发布于 2019-01-30 03:22:37
来自Google Codelabs:
结构化数据提供了一种方法来标准化有关页面的信息并对页面内容进行分类。JSON用于简单的面向JavaScript的对象表示法中的数据,是Google首选的结构化数据格式。JSON-LD应该在页面或页面中的元素中。
有一些示例说明如何将其实现为Codelab指南将结构化数据添加到网页中的一部分。
至于您使用的数据,这取决于您的网站帖子和网页是什么。根据内容的不同,有许多不同的模式,您可以在https://schema.org网站上浏览它们以及JSON示例代码。例如,如果您的文章是一本书的评论:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebPage",
"breadcrumb": "Books > Literature & Fiction > Classics",
"mainEntity":{
"@type": "Book",
"author": "/author/jd_salinger.html",
"bookFormat": "http://schema.org/Paperback",
"datePublished": "1991-05-01",
"image": "catcher-in-the-rye-book-cover.jpg",
"inLanguage": "English",
"isbn": "0316769487",
"name": "The Catcher in the Rye",
"numberOfPages": "224",
"offers": {
"@type": "Offer",
"availability": "http://schema.org/InStock",
"price": "6.99",
"priceCurrency": "USD"
},
"publisher": "Little, Brown, and Company",
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4",
"reviewCount": "3077"
},
"review": [
{
"@type": "Review",
"author": "John Doe",
"datePublished": "2006-05-04",
"name": "A masterpiece of literature",
"reviewBody": "I really enjoyed this book. It captures the essential challenge people face as they try make sense of their lives and grow to adulthood.",
"reviewRating": {
"@type": "Rating",
"ratingValue": "5"
}
},
{
"@type": "Review",
"author": "Bob Smith",
"datePublished": "2006-06-15",
"name": "A good read.",
"reviewBody": "Catcher in the Rye is a fun book. It's a good book to read.",
"reviewRating": "4"
}
]
}
}
</script>
您可能希望用钩子将脚本插入站点的顶部,从页面/帖子中提取数据。
发布于 2019-01-30 01:38:51
这个插件将帮助您链接
https://webmasters.stackexchange.com/questions/120778
复制