Facebook Sharer - Title and summary Customization

AlvaroAV picture AlvaroAV · Feb 27, 2014 · Viewed 19.6k times · Source

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.

Answer

AlvaroAV picture AlvaroAV · Jun 17, 2014

Facebook Sharer without Open Graph meta tags

I change correct answer after this long because in a new project, I had to do the same in the old way, and I finally get this code to works fine by creating a simple app in facebook:

Info for this sample apps: Facebook Send Dialog

APP_ID: Facebook app Identifier
http://www.THEPAGE.com: This would be my domain

$('#share_button').bind('click', function(e){
        e.preventDefault();
        var title = 'Title I want';
        var im_url = 'url_to_image';
        var facebook_appID = 'YourFacebookAppID'
        url = "https://www.facebook.com/dialog/feed?app_id="+ facebook_appID +    "&link=" + encodeURIComponent("http://www.THEPAGE.com")+ 
                    "&name=" + encodeURIComponent(title) + 
                    "&caption=" + encodeURIComponent('Shared from MY_PAGE') + 
                    "&description=" + encodeURIComponent('DESCRIPTION') + 
                    "&picture=" + encodeURIComponent("http://www.THEPAGE.com" +im_url) +
                    "&redirect_uri=https://www.facebook.com";
        window.open(url);
    });

Facebook app is needed to do this

To create your facebook app you need to register as developer and create the app visiting the next link:

Facebook Developer APPS