开发者

Is there a way to get the current post URL in Blogger?

I need the post URL for some Share buttons. Is there a way to retri开发者_如何学运维eve it? Thanks


You can retrieve the post URL via a layout data tag: data:post.url

If you just want to insert its value as text in your template, use it as tag: <data:post.url>

If you want to use a tag value for a html attribute, precede the html attribute with the prefix expr, for example:

<body expr:class='data:blog.mobileClass'>
  ...
</body>


I Used below script in my blog (www.it.itmrk.com), which is working for me.

<script type='text/javascript'>
     var postUrl = '<data:post.url/>';
     document.write("<div class="fb-like" data-href='" + postUrl + "' data-layout="standard" data-action="recommend" data-show-faces="true" data-share="true"></div>");
</script>

Its give link of each post accordingly. It might help full for you also.


You must create an expression, then name the metadata, and in quotation marks the value that you will have. In this way, blogger knows what convets the expression to metadata of the "div"

example code:

<div class="fb-like"  expr:data-href='data:post.url' data-layout="standard" data-action="like" data-size="small" data-show-faces="true" data-share="true"></div>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜