Advertisement:

Author Topic: [TUTO] Tell Facebook HOW to share your site's URLS  (Read 10762 times)

volunteer

  • Full Member
  • ***
  • Posts: 241
[TUTO] Tell Facebook HOW to share your site's URLS
« on: March 28, 2014, 03:23:37 pm »
Not sure if this is already in the forum, did a quick search and didn't find it.

When someone shares your base url link on Facebook you can choose what image facebook will use by adding this to your theme's main.php

Code: [Select]
<meta property="og:image" content="http://www.yousite.com/oc-content/themes/youtheme/images/logo.jpg" />
Facebook scrapes pages every 24hs so you won't see a change immediately but can see it on: https://developers.facebook.com/tools/debug by entering your URL

If in Object Properties/og:image (result from fb debugger tool) you see the image you want job done, it will be working soon :)

Facebook does a good job picking the right thumbnail to share in item.php so no need to modify that.


Extras: if you want to change or add a longer text for your site title/description that the one you specified in the admin panel options, you can go for the following metas for fb

Code: [Select]
<meta property="og:title" content="Whatever title" />
<meta property="og:description" content="description of your site"/>

EXAMPLE FOR ITEM.PHP
Code: [Select]
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#">
<meta property="fb:app_id" content="YOUR FB APP ID HERE" />
<meta property="og:type"   content="website" /> 
<meta property="og:url" content="<?php echo osc_item_url() ; ?>" />
<meta property="og:title" content="<?php echo osc_item_title(); ?>" />
<meta property="og:image" content="<?php echo osc_resource_url(); ?>" />

EXAMPLE FOR MAIN.PHP
Code: [Select]
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#">
<meta property="fb:app_id" content="YOUR FB APP ID" />
<meta property="og:type"   content="website" /> 
<meta property="og:url" content="http://www.yoursite.com/" />
<meta property="og:title" content="what ever you like, can be different from general settings in your admin panel" />
<meta property="og:description" content="what ever you like"/>
<meta property="og:image" content="http://your_logo_at_least_200x200.jpg" />

hope it helps someone. cheers!
« Last Edit: April 06, 2014, 03:27:32 am by volunteer »

leboncoin

  • Jr. Member
  • **
  • Posts: 63
Re: [TUTO] Tell Facebook what to to share from your site
« Reply #1 on: March 29, 2014, 12:59:25 am »
That is very useful Thanks - but what about when someone want to share an ad  will they still be able to choose images or it will show the logo by default?

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: [TUTO] Tell Facebook what to to share from your site
« Reply #2 on: March 29, 2014, 03:30:39 am »
the change in main.php doesn't affect the ads (item.php) facebook will choose from there automatically and so far, in my site, fb has done a good job picking thumbnails from the photos uploaded with each ad

leboncoin

  • Jr. Member
  • **
  • Posts: 63
Re: [TUTO] Tell Facebook what to to share from your site
« Reply #3 on: March 29, 2014, 05:39:25 pm »
Oh i see now - thanks anw :)

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: [TUTO] Tell Facebook what to to share from your site
« Reply #4 on: April 05, 2014, 10:34:06 pm »
examples added  :)

andreamarucci

  • Newbie
  • *
  • Posts: 1
Re: [TUTO] Tell Facebook HOW to share your site's URLS
« Reply #5 on: April 24, 2014, 06:10:09 pm »
Where exactly do I've to put the code in item.php and main.php?

keerthi

  • Hero Member
  • *****
  • Posts: 505
Re: [TUTO] Tell Facebook HOW to share your site's URLS
« Reply #6 on: June 03, 2014, 01:44:30 pm »
never mentioned where to add and how. pls mention.

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: [TUTO] Tell Facebook HOW to share your site's URLS
« Reply #7 on: June 03, 2014, 02:06:49 pm »
wherever you would like .. is your website and the design is made according to yours needs
« Last Edit: June 03, 2014, 05:00:56 pm by volunteer »

keerthi

  • Hero Member
  • *****
  • Posts: 505
Re: [TUTO] Tell Facebook HOW to share your site's URLS
« Reply #8 on: June 03, 2014, 02:36:51 pm »
I just need the metas of main to appear on the main page and metas for item page appear for item page. Is it done using an if loop. if so how? pls show.

chewyluke

  • Full Member
  • ***
  • Posts: 208
Re: [TUTO] Tell Facebook HOW to share your site's URLS
« Reply #9 on: June 06, 2014, 05:07:05 pm »
Is this to auto post new ads to FB? I haven't been able to use auto posting for 2 years. I've tried various RSS FB apps for my fan page since and nothing works.

april123

  • Newbie
  • *
  • Posts: 7
Re: [TUTO] Tell Facebook HOW to share your site's URLS
« Reply #10 on: July 05, 2014, 06:09:09 pm »
 8)

mantas

  • Jr. Member
  • **
  • Posts: 52
Re: [TUTO] Tell Facebook HOW to share your site's URLS
« Reply #11 on: July 06, 2014, 11:34:29 pm »
Is this to auto post new ads to FB? I haven't been able to use auto posting for 2 years. I've tried various RSS FB apps for my fan page since and nothing works.
You can auto post from rss using http://twitterfeed.com/
But facebook bug is that all the time pulls incorrect image(thumbnail), and this topic is about how to fix that ;)

Magnettoo

  • Full Member
  • ***
  • Posts: 216
Re: [TUTO] Tell Facebook HOW to share your site's URLS
« Reply #12 on: November 07, 2014, 04:02:23 am »
Hi guys,

can someone advice how to make call for more than one picture..

this gives me just 1 option in facebook sharer..
<meta property="og:image" content="<?php echo osc_resource_url() ; ?>" />

is there any way how to make a call for the rest of the pictures on particular item's url so they would be as an alternative options to the main picture already called by line shown above..

many thanks,
pete

Hello

  • Full Member
  • ***
  • Posts: 174
Re: [TUTO] Tell Facebook HOW to share your site's URLS
« Reply #13 on: November 07, 2014, 12:52:48 pm »
seems good. but pls make video tutorial...  ;)

bogdan0393

  • Newbie
  • *
  • Posts: 9
Re: [TUTO] Tell Facebook HOW to share your site's URLS
« Reply #14 on: January 22, 2015, 02:42:09 am »
Hi there!
I tryed this method <meta property="og:image" content="<?php echo osc_resource_url(); ?>" /> and no working...
If I debugging a new link on facebook debugger, my default image from og:image are blank with http://mywebsite/0.

Any ideea ?!

I`m looking to change og:image with default item photo, because in the present if I get a new link in debugger on facebook, on the og:image appear only thumbnails item image and other image (logo, etc)

www.adanunt.ro are my website....