urmaul/yii-opengraph

Yii component to store and render opengraph tags.

v1.3.0 2015-11-11 07:01 UTC

This package is not auto-updated.

Last update: 2024-11-09 16:42:54 UTC


README

Yii component to store and render opengraph tags.

Why

  • You can make only first/last occurance of metatag to be rendered.
  • It converts image links to absolute.
  • You'll white it anyway.

Supported tags

  • og:title
  • og:url
  • og:description
  • og:image

Installing

Add this to "components" part of your config.

'og' => array(
    'class' => 'ext.opengraph.Opengraph',
),

Using

// Set og:image
Yii::app()->og->image = $imageUrl;
// Set og:image if not set
Yii::app()->og->setImage($imageUrl, false);

// Flush contents to ClientScript
Yii::app()->og->flush();