cogAdds OpenGraph tags to page head.
TypeXAR
CategoryApplication
Developed by

slauriere

Active Installs1
Rating
Rate!
1 Votes
LicenseGNU Lesser General Public License 2.1
Compatibility

XWiki Standard 11.1

Installable with the Extension Manager

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:url" content="https://www.xwiki.org/xwiki/bin/view/Main/"/>
<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:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. 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:

#foreach($uix in $services.uix.getExtensions("org.xwiki.platform.html.head", {'sortByParameter' : 'order'}))
  $services.rendering.render($uix.execute(), 'xhtml/1.0')
#end

Release Notes

v1.0

  • Closed OPENGRAPH-1 Add Open Graph Protocol support to page head
Tags:
Created by slauriere on 2019/02/07 10:47
    

Get Connected