Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set og:image so it takes image from page?

I am using mediawiki 1.19 and I've added facebook 'like'. When I click like the image posted is the site logo. How do I take the image from the page. I've run the site through http://developers.facebook.com/tools/debug and it seems og:image is set to the site logo. How do I change this meta property? My site is thepetwiki.com Thanks

like image 420
LTech Avatar asked May 20 '12 08:05

LTech


People also ask

How do you put a Og on a picture in HTML?

You can set a custom og:image on a page by page basis. Just go to Page Settings > Social Image > Upload. If you need to add other OG tags and customize the default settings, go to Page Settings > Advanced > Page Header Code Injection. Read the following section on adding the tags manually and copy-paste the code there.

Can I use SVG for OG image?

As of Jan 14, 2021, Facebook's Sharing Debugger at developers.facebook.com/tools/debug emits a warning: Unsupported Image File Extension — Provided og:image URL, https://example.com/og_image.svg does not have a supported extension.


1 Answers

You are going to gave to add some custom og:tags to the HTML markup of your page and specify the image that you want to use...

Take a look at the example from the Facebook documentation -

<html xmlns="http://www.w3.org/1999/xhtml"       xmlns:og="http://ogp.me/ns#"       xmlns:fb="https://www.facebook.com/2008/fbml">   <head>     <title>The Rock (1996)</title>     <meta property="og:title" content="The Rock"/>     <meta property="og:type" content="movie"/>     <meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>     <meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>     <meta property="og:site_name" content="IMDb"/>     <meta property="fb:admins" content="USER_ID"/>     <meta property="og:description"           content="A group of U.S. Marines, under command of                    a renegade general, take over Alcatraz and                    threaten San Francisco Bay with biological                    weapons."/>     ...   </head>   ... </html> 

As you can see the og:image parameter is specified here and that allows Facebook to correctly display the meta data associated with that URL...

You might not need all of the og:tags specified here, title,url,image and description should be fine for just a LIKE button.

You are already aware of the debugger tool - it will help you debug your LIKE button and og:tags. Make some changes in your HTML markup and each time you'll have to send your URL though the debugger to refresh Facebook's cached version of your URL.


A quick Google search gave me this mediawiki extension that looks like it could help you -

http://www.mediawiki.org/wiki/Extension:OpenGraphMeta

OpenGraphMeta provides OpenGraph protocol metadata for articles on the wiki for 3rd parties like Facebook to extract...

like image 199
Lix Avatar answered Oct 06 '22 14:10

Lix