Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Sharer - Title and summary Customization

I'm working in a project with Django and I'm trying to share pages in facebook and twitter

I have problems on facebook, I want to customize the Title and summary shared, to change the text when you share an Index Page and any other page.

I tried using:

<a href='http://www.facebook.com/sharer.php?s=100&
p[title]=TITLE+TEST&
p[summary]=summary&
p[url]=http://{{ request.META.HTTP_HOST }}{{ request.path }}&
p[images][0]=http://whatever.com/media/img/img_facebook.jpg' 
target="_blank">
<img src="{{STATIC_URL}}img/ico_facebook_small.png" title="Facebook" alt="Facebook" ></a>

and even adding:

<meta property="og:title" content="My Title" />

The only 2 things I can change is the url showed and the image. Facebook sharer ignores title and summary. I search trough internet the last hour and I didn't find any solution that works for me.

Anyone knows if the facebook sharer isn't working anymore ? is there any solution to custom title and summary ?

Thanks


EDIT

Now I'm using og meta tags, but still have a problem. I want that each page has different titles, and I need to get the title via Javascript (I change the "og:title" content via js) but it seems the change take effect too late, because Facebook only get the part of the title that is static.

I have something like:

<meta property="og:title" content="TitlePage" /> 

and change the content via js to make like

<meta property="og:title" content="TitlePage SOMETHINGELSE" /> 

The change takes effect nice and without problems but like I said, facebook doesn't detect that change.


EDIT 2

I've answered my own question because I've found a solution to do the sharing in the old way, but an app is needed to make the code works.

like image 987
AlvaroAV Avatar asked Feb 27 '14 10:02

AlvaroAV


2 Answers

I agree with other answers, use the OpenGraph Protocol

  1. However, if it doesn't work make sure your URL is publicly visible.
  2. If it still doesn't work and you are absolutely sure your meta tags are correct that means Facebook cached your page.
  3. To remove Facebook cache go to the Facebook Object Debugger page and paste your link. By doing this Facebook will force its cache to be refreshed and show you values of your meta tags. That should fix your problem.
like image 37
glautrou Avatar answered Oct 21 '22 04:10

glautrou


Well, I am in the similar situation with you... The sharer.php with customized title and description was working up to a few days ago, and since then, only the OG metada are showing up, when they exist !

If you can, I suggest you to use the official version of the sharer URL, which now only accepts the shared URL in the query string, e.g.: https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fparse.com

See https://developers.facebook.com/docs/plugins/share-button/#faqdialog

Then you'll have to set up the Open Graph metadata on your page.

You can check how Facebook process your page with their debug page : https://developers.facebook.com/tools/debug/

edit :

Custom parameters in the sharer.php URL are officially not supported anymore : https://developers.facebook.com/bugs/357750474364812

Ibrahim Faour - Developer Support Engineer at Facebook

We have changed the behavior of the sharer plugin to be consistent with other plugins and features on our platform.

The sharer will no longer accept custom parameters and facebook will pull the information that is being displayed in the preview the same way that it would appear on facebook as a post from the url OG meta tags.

like image 90
vcarel Avatar answered Oct 21 '22 04:10

vcarel