Extension:OpenGraphMeta

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
OpenGraphMeta
Release status: beta
Implementation Data extraction, Parser function
Description Provides OpenGraph meta tags providing data for 3rd parties like Facebook to extract
Author(s) Daniel Friesen (Dantmantalk)
Latest version 0.5.0
Compatibility policy master
MediaWiki 1.25+
Database changes No
License GNU General Public License 2.0 or later
Download
Parameters
  • $egFacebookAppId
  • $egFacebookAdmins
Hooks used
ParserAfterTidy
BeforePageDisplay
Translate the OpenGraphMeta extension if it is available at translatewiki.net
Check usage and version matrix.

The OpenGraphMeta extension provides OpenGraph protocol metadata for articles on the wiki for 3rd parties like Facebook to extract. The primary use for this extension is for any wiki that provides its users a button to "Like" pages on the wiki, especially if the wiki uses a custom default skin. As sometimes Facebook can extract undesirable parts from the page (known on some custom skins to potentially extract random images irrelevant to the content) providing this data gives Facebook clean data to display in likes, and cleans up the long title into a pair of clean site and page titles. A parser function {{#setmainimage:Filename.ext}} which also exports what it is passed so you can use it easily in a [[File:{{#setmainimage:Filename.ext}}|thumb|right|...]] format can be used to set the image in the article which you prefer Facebook to use when displaying information about the page on your wiki (hint: This works very nicely when you incorporate it into an infobox template making the infobox image the preferred image for 3rd parties to use).

This extension can also be paired with Extension:Description2 which extracts description information from articles, when both are installed OpenGraphMeta will make use of the information Description2 extracts.

We need to provide the ability to maximize the amount of information available of the shared content so that it is more descriptive, while still in compliance with our policy.

Installation[edit]

Try the development version, or choose the version that matches your version of MediaWiki if the trunk version breaks.
  • Download and place the file(s) in a directory called OpenGraphMeta in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'OpenGraphMeta' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.29 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.29 and earlier), instead of wfLoadExtension( 'OpenGraphMeta' );, you need to use:

require_once "$IP/extensions/OpenGraphMeta/OpenGraphMeta.php";

See Also[edit]