I am currently creating a Tweet button for my website but have little knowledge of Twitter. I would like the text to say something similar to 'I like' and be followed by the title and url for the current page. I can make it display the text that I would like, or the page title, but cannot seem to get the text AND the page title into the tweet together.
So I would like the tweet to be... 'I like [page title] at Phil's website - [url for specific page]'
Is it possible to get it from meta data and open-graph similar to how facebook works?
Thanks in advance for any help, the code below is taken from the Twitter website with a few edits made.
Tweet<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
Related
can someone please advice me on how I can display hyperlink words instead of the full pdf links on my whatsApp share text field, I have started with this:
https://wa.me/?text=Aqua-Right%203%20https://rolfesagri.co.za/wp-content/uploads/2021/01/Aqua_Right_3_Label-1.pdf, http://rolfesagri.co.za/wp-content/uploads/2021/01/Aqua_Right_3_SDS-1.pdf, http://rolfesagri.co.za/wp-content/uploads/2021/02/Aqua-Right_Range_Eng_Pamphlet.pdf
This link needs to look like this when you send it to someone:
Aqua-Right 3 Label, SDS, Pamphlet
Is this possible?
These are three different links and you need to treat a link using the <a> tag.
See the documentation for the detail but your code will look like:
Label
<a href="https://wa.me/?text=Aqua-Right%203%20http://rolfesagri.co.za/wp-content/uploads/2021/01/Aqua_Right_3_SDS-1.pdf>SDS</a>
<a href="https://wa.me/?text=Aqua-Right%203%20http://rolfesagri.co.za/wp-content/uploads/2021/02/Aqua-Right_Range_Eng_Pamphlet.pdf>Pamphlet</a>
This is completely untested on what the link itself will do but is the right syntax to display a link on a webpage
I'm trying to encode vertical bars in Blogger titles in urls because when I push an html tweet button on a post, Twitter's pop-up window doesn't show anything to tweet. However, when I encode the vertical bar to %7C, everything works fine.
For example, MSNBC uses vertical bars to split up their titles on Youtube, and I automatically embed their videos on one of my blogs. See here:
President Donald Trump's Friday Tweet: 'Iran Is Playing With Fire' |
Morning Joe | MSNBC
https://us-gov.blogspot.com/2017/02/president-donald-trumps-friday-tweet.html
But if anyone tries to tweet the post, they get a blank screen with the url https://twitter.com/share?url=https://us-gov.blogspot.com/2017/02/president-donald-trumps-friday-tweet.html&text=President%20Donald%20Trump%27s%20Friday%20Tweet:%20%27Iran%20Is%20Playing%20With%20Fire%27%20|%20Morning%20Joe%20|%20MSNBC
But if I encode the vertical bars to %7C, the Twitter window works fine.
https://twitter.com/share?url=https://us-gov.blogspot.com/2017/02/president-donald-trumps-friday-tweet.html&text=President%20Donald%20Trump%27s%20Friday%20Tweet:%20%27Iran%20Is%20Playing%20With%20Fire%27%20%7C%20Morning%20Joe%20%7C%20MSNBC
I'm just wondering if there's an easy way to prevent this from happening in my blog template's html code. Or if there's a simple script to use.
Thanks.
Instead of using the current share URL which is of the form -
<a expr:href='"https://twitter.com/share?url=" + data:post.url + "&text=" + data:post.title' aria-label='' class='resp-sharing-button__link' rel='nofollow' target='_blank'>Twitter</a>
Use the native sharing URL generator provided by Blogger -
<a expr:href='"https://www.blogger.com/share-post.g?blogID=" + data:blog.blogId + "&postID=" + data:post.id + "&target=twitter"' aria-label='' class='resp-sharing-button__link' rel='nofollow' target='_blank'>Twitter</a>
This will generate the URL of the form -
https://www.blogger.com/share-post.g?blogID=BLOGID&postID=POSTID&target=twitter
This will then automatically redirect to Twitter sharing window with the Title and URL of the post auto-filled. The title of the post will be escaped. This sharing URL generator can also be used for generating sharing URLs for other social networks as well (aka facebook,pinterest,email,googleplus by replacing the target parameter)
The downside of this being that you can't add users to follow or add hashtags like you would normally be able to do when building the Twitter sharing URL.
I've just added the Twitter button on my blog under each post, but the tweets number displayed is the same on each button and is random.
In addition to this, if I enter to a post the number displayed change :S
Any idea about this issue?
EDIT:
This is the code that I'm actually using for the Twitter button
<a class='twitter-share-button' data-count='horizontal'data-lang='it'
data-via='ZOMBIEKB' expr:data-text='data:post.title'
expr:data-url='data:post.url' href='https://twitter.com/share'>Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)
[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=&
quot;//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore
(js,fjs);}}(document,"script","twitter-wjs");</script>
Each widgets data-url has to point to the url of the post it is describing not yout blog url:
yes: data-url="http://www.zombiekb.com/url-to-this-post/"
no: data-url="http://www.zombiekb.com/"
I try to post on user wall but i don't know how to put a specific link from my page in the link parameter.
If i write something like this it doesn't works:
$link='/path/foto.php?id='.$id;
$facebook->api('/me/feed', 'POST',
array('link' => $link,
'message' => 'Lorem ipsum')
);
and if i write something like this the link goes to a page outside facebook
$link='http://www.site.com/path/foto.php?id='.$id;
First sample doesn't work because URL of the link should be canonical not relative.
If you want to publish link that points to specific page on Facebook.com use full URL of that page. Be warned that content displayed aside of link is taken from OpenGraph meta tags so page must be publicaly accessivle, and not all pages on facebook.com define those tags (actually minority).
To give you a simple use case - on my website, I display the comments posted by the facebook users. For each comment I display the facebook users photo using the fb:profile-pic tag and a fb like button.
This page renders properly and everything displays well. Now when the users want to read older comments, they click on the "More" link
Using Jquery, I pull the older comments and in the javascript build the content adding the fb:profile-pic and the fb:like tags
But these tags dont show up. Do we need to reload it or something.
Thanks for your help
First make sure the FBML is being inserted into the DOM with an inspector. If so, all you need to do is tell Facebook to convert the FBML tags to HTML tags so your browser can render it. With the Graph API you call FB.XHTML.parse http://developers.facebook.com/docs/reference/javascript/FB.XFBML.parse using the Javascript SDK. Here's an example from my code:
$('#list').append('<fb:name uid="4"></fb:name>');
FB.XFBML.parse(document.getElementById('list'));
how do I do that - like right now I
build my entire string say
comment="<div>I love
icecream<br/><fb:profile-pic
uid='xxx'></fb:profile-pic></div>"
Then I would do
$("#myswipes").html(comment); So how
would I reload.
you can use $.ajax(), say
$('a.moreComment').click(function(){
$.ajax({
url: 'some/url.php',
success : function(comment){
$("#myswipes").html(comment);
}
});
})
some/url.php should be in the server that can correctly render and return this line, <div>I love icecream<br/><fb:profile-picuid='xxx'></fb:profile-pic></div>