2

I want to be able to import a heading, short description, and an image into my website, just using a link.

I am using Joomla but can switch to any CMS, or try to build an extension myself. The problem is, I don't know where to look for example code, or what to look for.

To me it doesn't seem like too difficult a process. Also, the code must be out there, with a little tweaking I can probably use someone else's, but I don't even know what to search for.

2
  • 1
    This is really unclear. Do you mean you want to build something like share links that automatically suggest a snippet etc. when posting to Facebook, and like the WordPress Press This bookmarklet?
    – Su'
    Commented Nov 24, 2012 at 10:24
  • @Michael I am trying to understand your question. Do you want to be able to post content FROM your website IN TO Google+ or Facebook (that's what your question title says), so that you control the particular "rich snippet" for that URL that displays e.g. image, lines of content etc? There is boilerplate for that, if that's what you want. But in your question, you said you want to import IN TO your website. From where, or is that not what you meant?
    – Ellie K
    Commented Nov 25, 2012 at 2:22

2 Answers 2

3

The feature you are looking for is called OPEN GRAPH. Its just a bunch of meta tags you place in the head of your site which tell Facebook information about it. That way when someone shares your site on Facebook, Facebook will use that information to populate the post. This includes the share image.

Here are the meta tags we use (replace xxx with appropriate values). I don't know Jack about Joomla, but I am sure there are plugins or ways to manipulate head content or add your own.

<meta property="og:title" content="xxx">
<meta property="og:description" content="xxx">
<meta property="og:type" content="website">
<meta property="og:url" content="http://xxx.com">
<meta property="og:site_name" content="xxx">    
<meta property="og:image" content="http://xxx/social/fb/facebook-share.png?v=1_ONDx13831750750541"/>
<meta property="fb:page_id" content="" />
<meta property="og:phone_number" content="1-800-000-000"/>
<meta property="og:street-address" content="xxx"/>
<meta property="og:locality" content="xxx"/>
<meta property="og:region" content="xxx"/>
<meta property="og:postal-code" content="xxx"/>
<meta property="og:country-name" content="xxx"/>            
0

When you paste a URL into Google+ or Facebook, they automatically fill in the post with information from that page. It sounds like you are trying to replicate that functionality for your site.

To do so, you would have to crawl the page to gather information about it. For example, Facebook uses a bot with the following user agent to download pages when URLs are shared: facebookexternalhit/1.1 (+https://www.facebook.com/externalhit_uatext.php).

The crawler would then need to extract information from that page. For example, the page title is between the <title> tags. The description is in the <meta name="description" content="..."> tag. Images can be taken from <img> tags. Facebook lets users choose which of the images from the page they want to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.