- Author: Mark Croxton
- OpenGraph.php: Scott MacVicar
This plugin allows you to fetch OpenGraph data from a url and display it in ExpressionEngine templates. Use it to create your own Facebook-style link cards.
- ExpressionEngine 2 or 3
- PHP 5.3 or later with DOM extension
Move the 'gangsta' folder to the ./system/expressionengine/third_party
directory.
Move the 'gangsta' folder to the ./system/user/addons
directory.
{exp:gangsta url="http://www.bbc.co.uk/news/world-europe-33406001"}
<article>
<header>
<h1>{og:site_name}</h1>
</header>
<a href="{og:url}">
<img src="{og:image}" alt="">
</a>
<h2><a href="{og:url}">{og:title}</a></h2>
<p>{og:description}</p>
</article>
{/exp:gangsta}
The URL to fetch OpenGraph data from.
Prefix for variables. Defaults to "og".
All metadata values found on the referenced webpage are returned as variables for use inside the {exp:gangsta}...{/exp:gangsta}
tag pair. These variables vary per site, but will usually include:
The URL of the webpage.
The name of the website hosting the referenced webpage.
The title of the webpage.
An image associated with the webpage. Note that only images with one of the following extensions will work:
- gif
- jpg
- jpeg
- png
- bmp
- tif
- tiff
- webp
A description of the webpage.
Use conditionals to check for the existence of a variable if you are unsure that the referenced site provides them.