OpenGraph Application
![]() | Adds OpenGraph tags to page head. |
Type | XAR |
Category | Application |
Developed by | slauriere |
Active Installs | 2 |
Rating | |
License | GNU Lesser General Public License 2.1 |
Compatibility | XWiki Standard 11.1 |
Description
This application adds OpenGraph support to XWiki page HTML head element. The Open Graph protocol enables any web page to become a rich object in a social graph. For instance, it is used to retrieve image to be displayed on Facebook, LinkedIn, Pinterest when publishing a web page to these sites.
This macro typically adds the elements below to the HTML head tag. The image elements are computed as follows: the extension first tries to include the URLs of the images attached to the current page, if any; otherwise it adds the URLs of images attached to the wiki home page, if any. The way these elements are added to the head can easily be customized and adpated to specific needs by editing the page XWiki.OpenGraphUIX.
<meta property="og:type" content="article" />
<meta property="og:title" content="Home" />
<meta property="og:image" content="https://www.xwiki.org/xwiki/bin/download/Main/WebHome/Earthrise1_Apollo8AndersWeigang_2048.jpg" />
The Facebook OpenGraph debugger can be useful for testing the output of this extension.
Prerequisites & Installation Instructions
We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.
You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:
- Log in the wiki with a user having Administration rights
- Go to the Administration page and select the Import category
- Follow the on-screen instructions to upload the downloaded XAR
- Click on the uploaded XAR and follow the instructions
- You'll also need to install all dependent Extensions that are not already installed in your wiki
This application requires the user interface extension point org.xwiki.platform.html.head, which was introduced in XWiki 11.5. In order to add this extension point to a previous version of XWiki, go to the "Presentation" section of the wiki administration and add the following lines just below the final "meta" tag:
$services.rendering.render($uix.execute(), 'xhtml/1.0')
#end