JSON-LD:在Blogger模板中使用数据:post.body

时间:2017-01-17 11:44:36

标签: templates blogger json-ld

我想在Blogger模板中使用JSON-LD中的帖子内容。

到目前为止,我有以下JSON-LD代码,这是无错误的,至少当我使用工具https://search.google.com/structured-data/testing-tool时:

{
  "@context": "https://schema.org",
  "@type": "BlogPosting",
  "author": {
    "@type": "Person",
    "name": "Billy Bathgate"
  },
  "image": {
    "@type": "ImageObject",
    "thumbnail": "thumbnail",
    "height": "100px",
    "url": "<data:post.thumbnailUrl/>",
    "width": "100px"
  },
  "publisher": {
    "@type": "Organization",
    "name": "My Blogspot Blog",
    "logo": {
      "@type": "ImageObject",
     "url": "https://4.bp.blogspot.com/-G8FrqwN9Wl4/WD2Xz7xBKII/AAAAAAAAAD0/mjrZlZrDy1daudafdegai3LKxxVfaACPcB/s320/dfare-adfte-SaP-de-90dpi.png",
      "width": 320,
      "height": 53
    }
  },
  "keywords": "<data:post.labels/>",
  "headline": "<data:view.title/>",
  "dateModified": "<data:post.lastUpdatedISO8601/>",
  "datePublished": "<data:post.timestampISO8601/>",
  "description": "<data:post.longSnippet/>",
  "mainEntityOfPage": "<data:blog.homepageUrl/>"
}

那么,我如何将帖子内容添加到JSON-LD?我看了http://jsonld.com/blog-post/,但是

"articleBody":"<data:post.body/>" 

将不被接受。

2 个答案:

答案 0 :(得分:1)

您要找的是<data:post.body.jsEscaped/><data:post.body.jsonEscaped/> - 类似于.cssEscaped,这对我来说是新模板的新发现。幸运的是,但是如果没有适当的Blogger模板文档,我们就会依赖它。

答案 1 :(得分:0)

您可以使用"articleBody":"<data:post.body.jsonEscaped/>"通过验证,但由于验证时间太长,因此我没有使用它。我还在Make Valid Blog Posting ldJson on Blogger

上找到了文档