OpenGraph API
![]() | Provides APIs to integrate OpenGraph in XWiki |
Type | JAR |
Category | API |
Developed by | slauriere, Manuel Leduc |
Active Installs | 0 |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
Script Service
Currently the API provides a single Script Service with a single method metas that return a Map of metadata derived from the content of the page as well as the XWiki.OpenGraph.Code.OpenGraphMetaClass XObjects from the page.
1.2+
OpenGraphScriptService
@Singleton
@Named("opengraph")
@Unstable
public class OpenGraphScriptService implements ScriptService
{
/**
* Retrieve the properties from the {@link OpenGraphMetaClassInitializer#XCLASS_DOCUMENT_REFERENCE} XObjects of the
* current document. Some missing properties are automatically completed when missing: {@link #OG_URL_PROPERTY},
* {@link #OG_TYPE_PROPERTY}, {@link #OG_TITLE_PROPERTY}, {@link #OG_DESCRIPTION_PROPERTY}, and
* {@link #OG_IMAGE_PROPERTY}.
*
* @return a map of open graph properties associated to one or many contents
*/
public Map<String, List<String>> metas()
{
// ...
}
}
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).
You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.
Dependencies
Dependencies for this extension (org.xwiki.contrib:application-opengraph-api 1.2.1):
- org.xwiki.platform:xwiki-platform-oldcore 10.11