TinKi
(Info)
November 20, 2012, 11:34pm
1
im facing about how to set <meta property=""> tag instead <meta name=""> absolutely correctly yii’s-style for Facebook opengraph
<meta property="og:title" content="something"/>
<meta property="og:description" content="something"/>
tryed to use Yii::app()->clientScript->registerMetaTag(‘description’, ‘example’), but it generates only <meta name="">
<meta name="example" content="description" />
maybe I’m wrong?
yiqing95
(Yiqing 95)
November 21, 2012, 2:21am
2
TinKi:
im facing about how to set <meta property=""> tag instead <meta name=""> absolutely correctly yii’s-style for Facebook opengraph
<meta property="og:title" content="something"/>
<meta property="og:description" content="something"/>
tryed to use Yii::app()->clientScript->registerMetaTag(‘description’, ‘example’), but it generates only <meta name="">
<meta name="example" content="description" />
maybe I’m wrong?
try this:
cs()->registerMetaTag('description',null,null,array('property'=>'og:title'));
cs() is short function for Yii::app()->clientScript;
TinKi
(Info)
November 21, 2012, 7:07am
3
Wow! Thank you. Works great even wth several property og:image.
julianm
(Julianmagnone)
May 3, 2013, 5:56pm
4
Awesome. Yes, worked like a charm. Now, I am seeing what is the best way to encapsulate this bunch of code, since Open Graph Project have some different metadata depending on the type, I am envisioning to have this code somewhere to make it usable. For example, to tag the view page, the user profiles, etc.