JSON-LD: Using data:post.body in Blogger template

梦想的初衷 提交于 2019-12-11 07:11:45

问题


I would like to use the post content in JSON-LD in my Blogger template.

I have the following JSON-LD code so far, which is errorfree, at least when I use the tool 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/>"
}

So, how would I add the post content to JSON-LD? I've looked at http://jsonld.com/blog-post/, but

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

will not be accepted.


回答1:


What you're looking for is <data:post.body.jsEscaped/> or <data:post.body.jsonEscaped/> - similar to .cssEscaped which was a new find for me with the new templates. Lucky guess, but that's we're left to rely on without proper documentation for Blogger templating.




回答2:


you can pass validation by using "articleBody":"<data:post.body.jsonEscaped/>" but im not using it since its too long. i also found documentation on Make Valid Blog Posting ldJson on Blogger



来源:https://stackoverflow.com/questions/41696276/json-ld-using-datapost-body-in-blogger-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!