Add open graph tags
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist fgh151/yii2-opengraph "*"
or add
"fgh151/yii2-opengraph": "*"
to the require section of your composer.json
file.
Once the extension is installed, add it to component config :
'components' => [
'opengraph' => [
'class' => 'fgh151\opengraph\OpenGraph',
],
//....
],
Then in controller or view set og tags
Yii::$app->opengraph->title = 'My post';
Yii::$app->opengraph->description = 'My post description';
Yii::$app->opengraph->image = 'http://site.ru/image.jpg';