Facebook sharer, pass in a comment? - facebook

Is it possible to post a description/comment variable to the facebook sharer url? It's only possible for url and title as far as I can figure out.

The parameters that you can pass to the actual sharer.php are "u" and "t" which are url and title. You can add meta tags to your page to get more info to appear in the sharer. To quote the docs (make sure you click the advance partners link):
In order to make sure that the preview
is always correctly populated, you
should add the tags shown below to
your html. An example news story could
have the following:
<meta name="title"
content="Smith hails 'unique' Wable legacy">
<meta name="description"
content="John Smith claims beautiful football ..." />
<link rel="image_src"
href="http://www.onjd.com/design05/images/PH2/WableAFC205.jpg" />
As shown, title contains the preview
title, description contains the
preview summary and image_src contains
the preview image. Please make sure
that none of the content fields
contain any html markup because it
will be stripped out. For
consistency's sake, please use the
<meta> tag to provide text data for
the preview, and the <link> tag for
any source urls.
The title and summary tags are the
minimum requirements for any preview,
so make sure to include these two.

You can actually pass custom title, url, image and comment/description using:
http://www.facebook.com/sharer.php?s=100&p[title]=titlehere&p[url]=http://www.yoururlhere.com&p[summary]=yoursummaryhere&p[images][0]=http://www.urltoyourimage.com

As shown, title contains the preview title, description contains the preview summary and image_src contains the preview image. Please make sure that none of the content fields contain any html markup because it will be stripped out. For consistency's sake, please use the <meta> tag to provide text data for the preview, and the <link> tag for any source urls.

Facebook sharer use the description meta tag to add a description in your post for the pictures. I don't really know how it works but I think it uses this tag in your header:
<link rel='image_src' href='http://www.yourwebsite/dir1/dir2/picture.jpg' />

Related

Website meta tag, special characters

Our website meta tag contains special characters such as "í and é" and when I share the website on Facebook the special characters show in a weird way, image attached. How can this be fixed?
Include the Open Graph XML namespace extension to your HTML declaration
< html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
Inside your use the following meta tag to define the image you want to use
< meta property="og:image" content="your_image_here" />
3.Visit https://developers.facebook.com/tools/debug/ and follow the instructions to change the final image for the preview.

Unable to make different meta descriptions for added Tumblr page

I finally have some time to work on some SEO on my Tumblr blog. On my main page, I have this meta tag
<meta name="description" content="{MetaDescription}" />
Now, when I created my new pages, "About", "Portoflio", etc., I obviously want to create different descriptions for these pages. But the tag above automatically gets added on my new pages. Is there a workaround on this? Or am I not doing it right?
edited: I forgot to mention... What I want in my other pages is NOT to take a snippet of the page content. I have specific shorter descriptions that I want to use. But with the tag above, it always automatically takes the snippet.

modX add og:image and og:description dynamically

I am trying to create a Facebook share option for my blog articles, and it works but it doesn't take the article text or image, but the first image and text on the (single page) website. How can I change my share code so that it will use the article's image and text from where I click the FB share button?
This is the template for the blog article, with the FB share code included:
<div class="contentLeft">
<div class="roundimage">
<a href="[[+roundImage:phpthumbof=`h=750&zc=1`]]" class="colorbox" title="[[+roundImageCaption]]"><img class="round"
src="[[+roundImage:phpthumbof=`w=170&h=170&zc=1&q=95`]]" alt="[[+roundImageCaption]]" /></a>
</div>
<script type="text/javascript">function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script>
<h4 class="blue" style="margin-bottom:10px; margin-top:0;">[[+articleHeadline]]</h4>
<p class="datetext">[[+datetimeText]]</p>
<p class="readmoretext">[[+articleText]]</p>
<div class="divider"></div>
</div>
I hope you can help! Thank you!
It should be enough to make sure that the article page, ie the link that you are sharing, embeds the correct og:image and og:description. You only share the link with the share button, and facebook will embed the link and look in it for the proper data.
Update:
I guess you're not using the articles package to create the blog? If you are you already have individual pages even if you're not using them =) If you're not i assume you're using some sort of resource loop to create your entries.
After looking around in the facebook docs it seems you can specify the image (https://developers.facebook.com/docs/opengraph/using-actions/v2.0#params) when creating your share button using the javascript sdk (https://developers.facebook.com/docs/sharing/reference/share-dialog). Each article will need to call something like this instead of the current javascript share url functionality.
FB.ui({
method: 'share_open_graph',
action_type: 'og.likes',
action_properties: JSON.stringify({
image: "YourImageForThisRespectiveShare",
})
}, function(response){});
If you prefer to explore the method i mentioned in the comments it would go something like this:
Look in your code at u=location.href;, you'd want to try modifying that to u=location.href+'?articleid=[~[*id*]~]';. When you share you should hopefully see the appended article ID for each article.
You'll then need to make sure you can specify og:image and description for each article, i assume you somehow have resources set up that represent each article, in that case just create a couple of template variables for that resource type.
In your header you could then use the getResourceField package for example to retrieve the correct TV from the correct resource, as specified by the ?articleid= parameter in your URL.
To retrieve the parameter you'll need a simple snippet like return (!empty($_GET['articleid']) ? $_GET['articleid'] : $default);. Lets name the snippet: "getArticleId". I left the option to decide a default image when there is no &articleid specified.
You're using modx evolution from the look of your [~[*id*]~] tag, but there should be some equivalent of the getResourceField package for evolution. This is the revolution version of the code needed:
<meta property="og:image" content="[[!getResourceField?
&id=`[[!getArticleId? &default=`[[*id]]`]]` //Take the blog page's own image as a default
&field=`imageTV` //you'll of course have to change "imageTV" to whatever you call it
&isTV=`1`
]]" />
Repeat for og:title and og:description, with their respective TV names.

Recommend button -> post on wall/timeline

When the user click "Recommend" button on my page, I'd like to post on his wall title and part of the article from my page. How can I change the information which is send to the user wall/timeline? I've found a tip that I should add open graph meta tags, but when I set og:title and og:description in META:
<meta content="Title" property="og:title">
<meta content="Description" property="og:description">
nothing change.
Any other ideas? Or maybe I do sth wrong?
[Edited]
My code:
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#">
<meta content="Test1" property="og:title">
<meta content="website" property="og:type">
<meta content="*Link to my web page*" property="og:url">
<meta content="*Link to my image*" property="og:image">
<meta content="Description" property="og:description">
<title>Page Title</title>
[...]
</head>
In the Object Debugger I get such messages:
Warnings That Should Be Fixed
Inferred Property: The og:url property should be explicitly provided,
even if a value can be inferred from other tags.
Inferred Property: The og:title property should be explicitly
provided, even if a value can be inferred from other tags.
Inferred Property: The og:locale property should be explicitly
provided, even if a value can be inferred from other tags.
Open Graph Object Properties
og:url: Link to my web page
og:type: website
og:title: Page Title
og:updated_time: 1319793567
Raw Open Graph Document Information
Canonical URL: Link to my web page
So it seems that the debugger gets only info from my page (e.g. <title>), not from Open Graph tags.
What I do wrong?
Probably I've found the reason of my problem - I render my page using JavaScript and then I set my META. Is there any way to set META (dynamically) visible for FB?
Did you run your page through the debug tool at http://developers.facebook.com/tools/debug ?
The debug tool clears Facebook's cache of your page as well as checking the syntax of your meta tags.
There are more tags required than the two you listed there
No, you can't dynamically create meta-tags. You need your server to render those meta-tags correctly when facebook decides to probe it (usually soon after a share/like/recommend operation).
EDIT : To make it clear -
There is no way to control the rendering of meta tags from the client.
If you want different URLs of your app to have different og:title, og:image etc.. you have to make sure your SERVER serves the html with the right meta tags for each URL.
Either put all the info you want in the URL in the first place, for example http://example.com/?title=shalom+world&image=shalom.png and then when you serve the page, parse the URL and render the meta-tags correctly OR..
Have some ID in the URL according to which you will go fetch a corresponding db record and render the head tag of the html you serve with info from that record as meta tags, for example: http://example.com/DB-RECORD-ID-X123

Facebook Share Link not posting the right URL

I am using code found in http://www.facebook.com/share_partners.php/
It says to replace with the URL I want to share.
The page where the share icon is placed is NOT the URL I want to share. The URL I want to share I enter as
However, first it worked, but now it is pulling the meta value AND the URL from the actual page!
My concern is that it is grabbing the URL from the page, not what I input because of:
u=location.href;t=document.title
On the page (both the one with the share icon AND the actual shared page) I tried to define the preview image with:
<link rel="image_src"
This is located between the tags...doesn't seem to do anything.
Thoughts?
You can only change the title
everything else is fetched directly from the shared url.
i dont 100% understand what you want to do
<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script>
Share
replace the u=location.href with u= and t=document.title with the given title. additionally replace in the href="" of the link with the correct url
any other info is fetched by the meta tags of the target url
<link rel="image_src" href="http://www.onjd.com/design05/images/PH2/WableAFC205.jpg" />
the href="" links to the correct image
the tag needs to be within those meta tags (in the area)