Extension talk:OpenGraphMeta

About this board

The {{#setmainimage:}} no longer works...

2
Titanshadow (talkcontribs)

I've just upgraded to 1.31 and now all my pages that have {{#setmainimage:}} on them, no longer have images in the open graph data. Anyone know how to make this work again?

Zer00CooL (talkcontribs)

Currently the same thing on mediawiki 1.32.0 extension does not seem to work properly, the image tag is not taken into account. I only have the following TAGs, using this extension:


<meta property="og:type" content="article"/>

<meta property="og:site_name" content="Analyse Développement Hacking"/>

<meta property="og:title" content="Accueil Utiliser MediaWiki"/>

<meta property="og:url" content="https://wiki.visionduweb.fr/index.php?title=Accueil_Utiliser_MediaWiki"/>


But, i have add the image !

-> https://wiki.visionduweb.fr/index.php?title=Accueil_Utiliser_MediaWiki#Configurer_la_balise_image_OpenGraph_avec_l.27extension_OpenGraphMeta

Reply to "The {{#setmainimage:}} no longer works..."

Image tag not working

4
Thecryptochat (talkcontribs)

I have installed this extension along with TwitterCards. All of the og tags seem to work minus the image tag. The image tag seems to only work on the homepage of the wiki. I have tried googling and tried every suggestion I've found but nothing seems to work at this point. Any help would be greatly appreciated.

Ciencia Al Poder (talkcontribs)

I have the same problem. I installed Extension:PageImages and it works like a charm, since it automatically selects the best image for sharing.

Tinss (talkcontribs)

I think this is because the generated og:image thumbnail is too small and Facebook refuses to display anything below 200x200. I have provided a fix in this comment.

Zer00CooL (talkcontribs)

Hello, currently, the extension does not seem to return any code Meta opengraph image. It would be no longer a problem of image size, but directly a problem of the extension.


I have only this Meta :

<meta property="og:type" content="article"/> <meta property="og:site_name" content="Analyse Développement Hacking"/> <meta property="og:title" content="Accueil Utiliser MediaWiki"/> <meta property="og:url" content="https://wiki.visionduweb.fr/index.php?title=Accueil_Utiliser_MediaWiki"/>


- > https://wiki.visionduweb.fr/index.php?title=Accueil_Utiliser_MediaWiki#Configurer_la_balise_image_OpenGraph_avec_l.27extension_OpenGraphMeta


Reply to "Image tag not working"
Ciencia Al Poder (talkcontribs)

This extension should use the DISPLAYTITLE instead of the actual page title, if provided on the page.

Reply to "DISPLAYTITLE"

setmainimage keeps grabbing a thumb instead of actual image

4
Tenzel Kim (talkcontribs)

When I put down {{#setmainimage:Filename.ext}} what I get in the og:image is not the actual image but a thumb of that image.

Example:

If I put down {{#setmainimage:Filename.png}} I get:

<meta property="og:image" content="http://sitename.com/wiki/images/thumb/5/5d/Filename.png/105px-Filename.png" />

instead of simply

<meta property="og:image" content="http://sitename.com/wiki/images/5/5d/Filename.png" />

Any ideas what can cause this?

Ciencia Al Poder (talkcontribs)
Tinss (talkcontribs)

Actually, 300x100 is now too small a value for Facebook, which required at least 200x200 for the og:image tag. I've submitted a bug on phabricator but if you want to fix the code yourself find OpenGraphMeta.class.php and change line 76 to:

$meta['og:image'] = wfExpandUrl( $mainImage->createThumb( 1200, 630 ) );
Tinss (talkcontribs)

The bug was fixed in change 431322. For those still having an issue with this, simply reinstall the extension.

Innosflew (talkcontribs)

I tried to install this on mediawiki 1.27 and adding {{#setmainimage:Filename.ext}} to all of my infoboxes but nothing is happening. When I try to share any of my pages it doesn't use the image that I set for it. I also checked the head of the page and it doesn't have an og:image in the meta tags, but it seems to have the other og: tags, such as og:type, og:site_name, og:title, and og:url.

Tribly (talkcontribs)

I have modified 47 line of the OpenGraphMeta.php of the OpenGraphMeta extension from Title::newFromDBkey($data['dbkey'], NS_FILE) to Title::newFromText($data['dbkey'], NS_FILE) and the og:image in the meta tags seems to apear now, but it still not willing to use the infobox image for a few pages.

Reply to "Not working"
Peachey88 (Flood) (talkcontribs)

This didn't seem to output the correct format for the OG meta tags due to the addMeta function called with the BeforePageDisplay hook. Could be my fault. For example, I am getting <meta name="property:og:type" content="article" /> when it should be <meta property="og:type" content="article"/>. Unless there's something I'm missing, addMeta will only return <meta name="$value1" content="$value2"/> formatted meta tags.

I am on MediaWiki 1.18.0, PHP 5.2.17, and MySQL 5.1.56--maybe the function addMeta has changed in the latest update? I corrected it by using the hook OutputPageBeforeHTML and the function addHeadItem to output:

foreach( $meta as $property => $value ) {
	if ( $value ){
		$out->addHeadItem( "OGMeta$i", '<meta property="'.$property.'" content="'.$value.'"/>'.PHP_EOL );
		$i++;
	}	

It seems to work. Thoughts?

This post was posted by Peachey88 (Flood), but signed as Lost Student.

Peachey88 (Flood) (talkcontribs)

Try the trunk or 1.17 version of the extension. The 1.18 version seams to contain a change made after the 1.17 branch but was reverted later on.

This post was posted by Peachey88 (Flood), but signed as Dantman.

Reply to "Bug or User Error?"

Mediawiki version required?

3
Peachey88 (Flood) (talkcontribs)

Hi all, I have just tested this extension on a 1.15.4 MediaWiki installation and I had an error reporting:

Call to undefined method OutputPage::getTitle() in C:\server\xampplite\htdocs\wiki\extensions\OpenGraphMeta\OpenGraphMeta.php on line 65

Installation data:

  • MW 1.15.4
  • PHP 5.3.0
  • MySQL 5.1.41

Extensions installed:

  • MultipleUpload 1.0
  • Cite r.37577
  • DSADate 1.0
  • DynamicPageList2 1.7.4
  • ImageMap r.35980
  • ImageSizeInfoFunctions 1.0.1
  • MultipleUploadToolboxItem 0.1
  • ParserFunctins 1.1.1
  • PropertyTable2 1.2.1
  • StringFunctions 2.0.1
  • SyntaxHighlight
  • GoogleTranslator 0.1
  • NewUserEmailNotification 1.5.1

Moreover, inspecting the code, it seems that the extension Description2 is required for properly description tag be evaluated. Is my assumption correct? TIA

This post was posted by Peachey88 (Flood), but signed as Briotti.

Peachey88 (Flood) (talkcontribs)

Yes, Description2 has the parsing code to extract a description from the page so OpenGraphMeta uses it instead of duplicating code.

Peachey88 (Flood) (talkcontribs)

OutputPage::getTitle was added in 1.16; 1.15 is not a supported MediaWiki version anymore, it's no longer receiving security updates and some security holes have been fixed in later versions of MediaWiki. So I see no reason to add 1.15 compat.

This post was posted by Peachey88 (Flood), but signed as Dantman.

Reply to "Mediawiki version required?"

Fork with Extension:PageImages integration

2
QuasarEE (talkcontribs)

I have created a fork of this extension which integrates with Extension:PageImages, so that if both are installed, the intelligent prioritized and automated image selections made by that extension can apply to the og:image property in lieu of other forms of specification (this fork also fixes the php exceptions that are thrown by MediaWiki 1.24 if this extension is installed unmodified, due to there not being a form of Title::newFromDBkey that accepts two parameters). You can find the source code for the customized branch here.

78.72.129.219 (talkcontribs)

Amazing, and amazing timing -- have been updating my wiki for OG starting a couple of days ago, and was scratching my head about how to sort out og:image without wrangling editors into manually doing it. This seems to work great! Only thing I wish I could do now is a mass-resave of articles on our wiki so that it could populate this faster.

Reply to "Fork with Extension:PageImages integration"

Can I include this function in a template?

2
Kaffeeringe (talkcontribs)
Reply to "Can I include this function in a template?"

How do I change og:image in the meta tags?

8
Lucy Tech (talkcontribs)

I've added the extension to localsetting.php and then I clicked 'edit' and added the code {{#setmainimage:Sunset.jpg}}. However when I click 'facebook like' it doesn't use the image 'sunset.jpg' and I've checked the meta data and there it hasn't changed the og:image source. How do I use this extension? What am I doing wrong?

Rotsee (talkcontribs)

Try changing NewFromDBKey to NewFromTitle, this code seems to rely on an older(?) version of the Title class.

Dantman (talkcontribs)

What are you talking about? Title::newFromDBKey still exists and always has. And since we have a DB key it's the right method to use. While Title::newFromTitle does not exist and is conceptually ridiculous.

Rotsee (talkcontribs)

Sorry, I just assumed that the reason this extensions doesn't seem to work with newer versions of MW was that it tried calling newFromDBkey like this Title::newFromDBkey($data['dbkey'], NS_FILE), whereas newFromDBkey now only seems to accept one parameter. Using newFromText instead, or something like Title::newFromDBkey( "File:" . $data['dbkey'] ) made it work for me. rotsee (talk) 19:02, 17 September 2012 (UTC)

Rotsee (talkcontribs)

Oops, did I write newFromTitle? That doesn't make sense, should have been newFromText, of course. :-) rotsee (talk) 19:03, 17 September 2012 (UTC)

Dantman (talkcontribs)

Is your wiki publicly available so I can debug?

Reply to "How do I change og:image in the meta tags?"