Sharing a TEXT alonsgide with a page text on FB and LINKEDIN? - facebook

I've just stumbled upon sharing a text (a hashtag) togeher with a text on Facebook / LinkedIn. Here is hwat I am trying to do (hashtag: #STUFF):
<li class="facebook"><a target="_blank" href="http://www.facebook.com/share.php?u=<?php echo '#STUFF'. urlencode(get_the_permalink()); ?>">facebook</a></li>
THIS, unfortunately doesn't work (no wonder!)
There is "Say Something about it" field on FB. Can I add a piece of code to the sharing button so that field will contain text (pretty much like with "subject" for email sending).
I am able to do that with Twitter. Like this:
<li class="twitter"><a target="_blank" href="https://twitter.com/intent/tweet?text=<?php echo urlencode(get_the_title() . ', #STUFF'); ?>&url=<?php echo urlencode(get_the_permalink()); ?>&original_referer=<?php ?>">twitter</a></li>

While I am uncertain about the other services, you can customize the share text on LinkedIn using this format (Note that all of the {} placeholder values should be replaced with URL-encoded values):
Link text
E.g.
Link text
Complete documentation for sharing content can be found here: https://developer.linkedin.com/docs/share-on-linkedin

Facebook
Using sharer, you can only specify url, like so...
https://www.facebook.com/sharer.php?u={url}
Source: Facebook Sharer Documentation.
BUT, if you register your app, get an app id, and install the Facebook share dialog plugin, then you have virtually unlimited access to specify sharing...
https://www.facebook.com/dialog/share?app_id={app_id}&display={page_type}&href={url}&redirect_uri={redirect_url}
Source: Facebook Dialog Documentation.
LinkedIn
So, you cannot really specify any text when sharing on LinkedIn. You can only set the url param. But you can set the og: tags to show title, image, etc., as a preview in your share page:
<meta property='og:title' content='Title of the article"/>
<meta property='og:image' content='//media.example.com/ 1234567.jpg"/>
<meta property='og:description' content='Description that will show in the preview"/>
<meta property='og:url' content='//www.example.com/URL of the article" />
Source: LinkedIn Developer Docs: Making Your Website Shareable on LinkedIn.
Verify that you did it right with: the LinkedIn Post Inspector.
BUT, similarly to Facebook, if you register your app, get an appid, etc., you can use this format fully to your heart's content...
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "Hello World! This is my first Share on LinkedIn!"
},
"shareMediaCategory": "NONE"
}
Source: Microsoft LinkedIn Documentation: Share on LinkedIn.

Related

Prestashop facebook share text

Hello please help me: if I paste link of my site to facebook message, facebook processes it to thumbnail + some text. There is text "Shop powered by PrestaShop". How do I change it?
Prestashop version 1.6.1.4.
Site address : http://myfleur.cz/
Thanks for any help.
Facebook's crawler scrapes the HTML of the URL that is shared. On a regular HTML page (similar to your case) this content is basic and may be incorrect, because the scraper has to guess which content is important, and which is not.
The good news is that you can take control of what the Facebook crawler picks up from each page by using Open Graph meta tags. These tags provide structured info about the page such as the title, description, preview image, and more.
So just add these meta tags in your homepage:
<meta property="og:url" content="<your-webpage-url>" />
<meta property="og:title" content="<new-title>" />
<meta property="og:image" content="<new-image-url>" />
(You can add other meta tags also as mentioned in the link mentioned)
P.S. You can use this url to debug, which content facebook is scraping from your website.
Hope that helps!
The solution in that case is go to
Preferences -> SEO & URLs -> index (edit)
and change there the Meta-Description.

AddThis Facebook custom parameters

I'm using custom AddThis buttons to share things in Twitter and Facebook... for Twitter share I use:
addthis:templates="{ twitter: ' {{title}} # {{url}} via #agenciauzzye' }"
I know that for the Facebook custom description, title, url, image and other things I must have to use meta tags. The problem is that I have a blog with one static page and all the content (posts) are loaded inside one div with AJAX. The main page is a posts list where I have the buttons to share each post...
How do you guys share content in Facebook with AddThis without set up the meta tags???
The only solution I found is to use direct Facebook share URL, without pass by AddThis code (and so, without log for analysis). Something like:
<a onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[summary]=<?php echo rawurlencode(striptags(abrev_texto(get_output($descricao),1000,"p"," ...",true)));?>&p[title]=<?php echo rawurlencode(get_output($post->titulo));?>&p[url]=<?php echo rawurlencode(ROOT_SERVER . ROOT . "blog/" . $urlAux); ?>&&p[images][0]=<?php echo rawurlencode($imageShare);?>','sharer','toolbar=0,status=0,width=548,height=325');" href="javascript: void(0)"></a>
You can see more details in http://blog.uzzye.com
Luckily the Facebook developers were smart enough to realize they cannot predict every type of web page on the internet. Instead, they offer a few simple meta tags that control how this information is passed to Facebook:
title: <meta name=”title” content=”The title of the link being shared” />
short description: <meta name=”description” content=”A description of the page” />
optional thumbnail image: <link rel=”image_src” href=”http://example.com/images/image.jpg” />
That’s all you need to tell Facebook what to populate in the link details when someone shares your page with others on Facebook.

Facebook and twitter share for mobile web

Is there a special url for sharing to Facebook and Twitter for mobile?
Or are they the same as those from websites?
Using
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
Twitter
for Twitter and
<script>
function fbs_click()
{
u='www.something';
t='title';
window.open('http://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}
</script>
<a rel="nofollow" href="http://www.facebook.com/sharer/sharer.php?u=someurl" onclick="return fbs_click()" target="_blank" class="">Facebook</a>
for Facebook.
Your sharing implementation should be the same and should work so long as your mobile users have devices capable or rendering JavaScript. Otherwise you can use each platforms' API url to share inside a link, the only problem is the callback redirects them either to Twitter or Facebook and they'll have to manually return to your site. The links are as below:
Sharing on Facebook:
http://m.facebook.com/sharer.php?u=<urlencoded url>t=<urlencoded title>
For example:
http://m.facebook.com/sharer.php?u=http://www.google.com
Updating status on Twitter:
http://mobile.twitter.com/home?status=<urlencoded status>
A couple of notes regarding Simpleton's answer.
The http://m.facebook.com/sharer.php URL may not be what you want. The site that you provide in the u query parameter needs to have some tags in the page in order for the share
page to be at all interesting. Just try putting another URL in there other than Google to see what I mean. I was never really able to figure out what it is looking for in the page of the site in order to show anything useful in your share page. I did not see any way to provide extra information about the site you are sharing.
The t query parameter is no longer read by facebook as far as I could tell
I found that the Facebook feed dialog was a better sharing alternative (https://developers.facebook.com/docs/reference/dialogs/feed/). See the example at the bottom of that page for the information you can share. Paste that example URL in to your browser to see what it looks like. You can play around with the parameters to see what each parameter controls in the post. For example, if you don't provide the caption parameter, it seems that the base URL of the link parameter is used in it's place. To use the feed dialog approach, you need to register your app in Facebook to get an app_id that you will need to include in the feed dialog URL. You also associate your app with a web site URL, which you also use in the feed dialog URL. If you want Facebook to serve you a mobile-friendly page, append &display=touch to the end of the feed dialog URL. Lastly, you must provide redirect_uri parameter where the user will be redirected (with the post ID included as a query parameter), so you have to have something at that URL to handle the response.
Regarding the http://mobile.twitter.com/home?status URL, I learned a couple of things: first, any URL's in include in the status will not be shortened (bummer); second, if your status includes any single quotes, they will be encoded as &#39 (HTML entity code) but will not get decoded when your post the tweet. However, this doesn't happen if you are posting via the desktop, using the same URL. You can see what I mean by trying the following URL from both your iPhone (I was using Safari on iPhone) and then from your desktop (I was using Safari):
http://mobile.twitter.com/home?status=Wayne's%20World
Note, I do an javascript encodeURI on the status, but single quotes are not generally encodable characters by most URL/I encoders. There are some that will replace the single quote with a %27, but I tried inserting that manually and it still didn't get decoded in the status text.
I hope this information helps someone comes here looking for simple Facebook and Twitter sharing options.
Twitter - This is how I solved the tweet by url for all devices/browsers issue:
http://twitter.com/intent/tweet?text= + encodeURIComponent(tweet);
encodeURIComponent - is a built in javascript function, explained here.
The 'http://mobile.twitter.com/home?status=' is not supported, and you will get encoding issues when twitter requests a login.
Facebook - For facebook sharing I used Facebook API example
The url is ok, but you need to do some work on your server to get Facebook to really make it look decent. Facebook now uses "Open Graph", which allows you to add special tags to your web page that Facebook understands. You can define what types of media are on the page, even add your own objects with definitions you create inside your Facebook app. The link to the developer Open Graph objects page is Here.
A sample of Open Graph on a detail page might look like this:
<meta property="fb:app_id" content="YOUR FACEBOOK_APP_ID }}" />
<meta property="og:url" content="The URL that this page is on" />
<meta property="og:site_name" content="Your domain" />
<meta property="og:title" content="Title of your page" />
<meta property="og:type" content="This is very important - it is how
Facebook refers to your post. Image, video, text, etc. Even custom stuff is
possible" />
<meta property="og:image" content="image url for facebook to display on
the user's wall" />
<meta property="og:determiner" content="auto" />
<meta property="og:description" content="A description you want with this
content" />
And so on. This all goes in the <head> of the page of the actual url you are supplying to Facebook. Then Facebook will translate this into the appropriate post. In addition, you need to set up the Open Graph on your apps developer page, so that Facebook knows to look for the og: tags. It's complicated, but it does work.
Good luck!

Facebook share link - can you customize the message body text?

I'm trying to create a link that will share a page on Facebook. So far I've got:
href="http://www.facebook.com/sharer.php
?u=http%3A%2F%2Fwww.cnn.com%2F
&t=CNN%26s+website"
However, I'd really like to add some text that will go in the 'What's on your mind?' text box (especially as the t value gets overridden by the link's title). Does anyone know if this is possible?
Simplest way to share on facebook is:
https://www.facebook.com/sharer/sharer.php?u=xerosanyam.github.io&quote=You_are_amazing
Bonus:
Simplest way to share on twitter is:
https://twitter.com/intent/tweet?via=xerosanyam&text=You_are_amazing
NOTE: #azure_ardee solution is no longer feasible. Facebook will not allow developers pre-fill messages. Developers may customize the story by providing OG meta tags, but it's up to the user to fill the message.
This is only possible if you are posting on the user's behalf, which requires the user authorizing your application with the publish_actions permission. AND even then:
please note that Facebook recommends using a user-initiated sharing modal.
Have a look at this answer.
You can't do this using sharer.php, but you can do something similar using the Dialog API. http://developers.facebook.com/docs/reference/dialogs/
http://www.facebook.com/dialog/feed?
app_id=123050457758183&
link=http://developers.facebook.com/docs/reference/dialogs/&
picture=http://fbrell.com/f8.jpg&
name=Facebook%20Dialogs&
caption=Reference%20Documentation&
description=Dialogs%20provide%20a%20simple,%20consistent%20interface%20for%20applications%20to%20interact%20with%20users.&
message=Facebook%20Dialogs%20are%20so%20easy!&
redirect_uri=http://www.example.com/response
The catch is you must create a dummy Facebook application just to have an app_id. Note that your Facebook application doesn't have to do ANYTHING at all. Just be sure that it is properly configured, and you should be all set.
November 2021 update
The feed part of the Dialog API no longer includes the message field in the message. It is not included in the feed dialog documentation. The fields picture, name, caption, and description are now deprecated.
Therefore, for the purpose of sharing to the wall, you're better off with sharer.php, which does not require an app_id, and therefore does not need registering an app:
http://www.facebook.com/sharer.php?u=https://example.com
Like #Ardee said you sharer.php uses data from the meta tags, the Dialog API accepts parameters. Facebook have removed the ability to use the message parameter but you can use the quote parameter which can be useful in a lot of cases e.g.
https://www.facebook.com/dialog/share?
app_id=[your-app-id]
&display=popup
&title=This+is+the+title+parameter
&description=This+is+the+description+parameter
&quote=This+is+the+quote+parameter
&caption=This+is+the+caption+parameter
&href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2F
&redirect_uri=https%3A%2F%2Fwww.[url-in-your-accepted-list].com
Just have to create an app id:
https://developers.facebook.com/docs/apps/register
Then make sure the redirect url domain is listed in the accepted domains for that app.
To add some text, what I did some time ago , if the link you are sharing its a page you can modify. You can add some meta-tags to the shared page:
<meta name="title" content="The title you want" />
<meta name="description" content="The text you want to insert " />
<link rel="image_src" href="A thumbnail you can show" / >
It's a small hack. Although the old share button has been replaced by the "like"/"recommend" button where you can add a comment if you use the XFBML version. More info her:
http://developers.facebook.com/docs/reference/plugins/like/
Like said in docs, use
<meta property="og:url" content="http://www.your-domain.com/your-page.html" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Your Website Title" />
<meta property="og:description" content="Your description" />
<meta property="og:image" content="http://www.your-domain.com/path/image.jpg" />
image size recommended: 1 200 x 630
Facebook does not allow you to change the "What's on your mind?" text box, unless of course you're developing an application for use on Facebook.
I don't think this is possible in the Dialog API, which triggers starting a message on Messenger. (Note: this is different from "posting to your wall" in the accepted answer, the difference being /dialog/send instead of /dialog/feed).
For example:
http://www.facebook.com/dialog/send?
app_id=123050457758183&
link=http://developers.facebook.com/docs/reference/dialogs/&
redirect_uri=http://www.example.com/response
See the Facebook documentation. As of November 2021, the documentation does not show the fields picture, name, caption, description: they are populated from the Open Graph tags of the website. I tried adding the field message and it failed to produce any text, but the link still redirects to Messenger.

Facebook Site Linking Support

When someone posts a link to a web site in Facebook, it populates the link preview box with a photo and some text from the site.
If someone posts a link to my site in Facebook, it is generally just get the site's domain name and one of the images that appears on the site. No text appears.
I would like to be able to control what text and images appear in the link. Is there a specification that they use? Can I provide some metadata so Facebook will display what I want?
Here is Facebook's developer page on their share function.
Basically there are some simple metatags you can use to optimize what appears on FB
<meta name="title" content="title" />
<meta name="description" content="description " />
<link rel="image_src" href="thumbnail_image" / >
AND:
The wiki article doesn't mention this, but Facebook CACHES the results of your site for awhile. So, if you're debugging & doing quick iterations, you either need to wait awhile, or rename the page (index2.html, index3.html, etc) until you find something that works.