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

I need a post url for some Share buttons. Is there any way to get it? Thanks

+4
source share
3 answers

You can get the url of the message using the layout data tag : data:post.url

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

If you want to use the tag value for the html attribute, you must use the expr prefix before the html attribute, for example:

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

I used the below script on my blog (www.it.itmrk.com), which works 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> 

It gives a link to each message accordingly. It can help you and you.

0
source

You must create an expression, then name the metadata, and in quotation marks, the value that you will have. This way the blogger knows what causes the expression for the metadata "div"

code example:

 <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
source

Source: https://habr.com/ru/post/1335944/


All Articles