首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >如何在博客文章中添加谷歌结构数据?

如何在博客文章中添加谷歌结构数据?
EN

Webmasters Stack Exchange用户
提问于 2019-01-30 07:45:55
回答 2查看 240关注 0票数 0

我想添加谷歌的结构数据在WordPress博客文章,网页。我需要在哪里放置结构数据(在身体或头部部分)?什么是正确的架构结构的文章或网页?

谢谢

EN

回答 2

Webmasters Stack Exchange用户

发布于 2019-01-30 11:22:37

来自Google Codelabs:

结构化数据提供了一种方法来标准化有关页面的信息并对页面内容进行分类。JSON用于简单的面向JavaScript的对象表示法中的数据,是Google首选的结构化数据格式。JSON-LD应该在页面或页面中的元素中。

有一些示例说明如何将其实现为Codelab指南将结构化数据添加到网页中的一部分。

至于您使用的数据,这取决于您的网站帖子和网页是什么。根据内容的不同,有许多不同的模式,您可以在https://schema.org网站上浏览它们以及JSON示例代码。例如,如果您的文章是一本书的评论

代码语言:javascript
代码运行次数:0
运行
复制
<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>

您可能希望用钩子将脚本插入站点的顶部,从页面/帖子中提取数据。

票数 1
EN

Webmasters Stack Exchange用户

发布于 2019-01-30 09:38:51

全部在一个架构中丰富的片段

这个插件将帮助您链接

票数 0
EN
页面原文内容由Webmasters Stack Exchange提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://webmasters.stackexchange.com/questions/120778

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档