htmlxmlblogger

Writing Blogger Tag inside Rich Snippet


This following rich snippet code is just an illustration:

{"@type":"ImageObject",
"inLanguage":"id-ID",
"@id":"HERE_IS_POST_THUMBNAIL_LINK_CODE",
"contentUrl"HERE_IS_POST_THUMBNAIL_LINK_CODE",
"width":1000,
"height":366,
"caption":"Bangka Guide Wisata dan Tour"

Then, this is the blogger tag to show a post thumbnail:

data:blog.postImageThumbnailUrl

I'd already tried like this:

"@id":"'+data:blog.postImageThumbnailUrl+'",
"contentUrl:"'+data:blog.postImageThumbnailUrl+'",

and also,

"@id":"data:blog.postImageThumbnailUrl",
"contentUrl:"data:blog.postImageThumbnailUrl",

But no luck.

I know that I must supply the tag "expr" at, for example:

<meta expr:content="data:blog.postImageThumbnailUrl" ............................../>

But where to place the expr to show the link of image or picture when I see the page from browser source code.

Note: The code is not inside blogger post but blogger page.


Solution

  • You can use this variable as a tag:

    <data:blog.postImageThumbnailUrl/>
    

    but this is 72x72px image, not 1000px

    This one will display the same size as set in the post body:

    <data:view.featuredImage/>
    

    You can also play with:

    <b:eval expr=''/> and resizeImage()
    

    to adjust the size to your needs.

    Example (from one of Blogger's themes):

    "image": {
     "@type": "ImageObject",
    <b:if cond='data:post.featuredImage.isResizable'>
     "url": "<b:eval expr='resizeImage(data:post.featuredImage, 1200, "1200:630")'/>",
     "height": 630,
     "width": 1200
    <b:else/>
     "url": "https://blogger.googleusercontent.com/img/b/U2hvZWJveA/AVvXsEgfMvYAhAbdHksiBA24JKmb2Tav6K0GviwztID3Cq4VpV96HaJfy0viIu8z1SSw_G9n5FQHZWSRao61M3e58ImahqBtr7LiOUS6m_w59IvDYwjmMcbq3fKW4JSbacqkbxTo8B90dWp0Cese92xfLMPe_tg11g/w1200/",
     "height": 348,
     "width": 1200
    </b:if>
    },
    

    this one is used inside the post/page loop which is why it has data:post.featuredImage instead of a global variable.