Hi all,
i’ve a curios error:
this is My action:
public function run() {
$cat = Yii::app()->request->getQuery('categoria');
Language::model()->ChangeSetLanguage(Yii::app()->session['lang']);
$imageName = Eventtolist::model()->GetDefaultImageName($this->controller->evento['id']);
$this->SetTags($imageName);
$this->controller->render('scheda', array('imageName' => $imageName, 'model' => $this->controller->evento, 'categoria' => $cat));
}
private function SetTags($imageName) {
Yii::app()->clientScript->registerMetaTag(Yii::t('pageBody', "site name. ") . GxHtml::decode($this->controller->evento['name']), 'description');
Yii::app()->clientScript->registerMetaTag('bunch,of,keywords', 'keywords');
Yii::app()->clientScript->registerMetaTag(GxHtml::decode($this->controller->evento['name']), null, null, array('property' => 'og:title'));
Yii::app()->clientScript->registerMetaTag('SardegnaCountry', null, null, array('property' => 'og:site_name'));
Yii::app()->clientScript->registerMetaTag(GxHtml::decode($this->controller->evento['name']), null, null, array('itemprop' => 'description'));
Yii::app()->clientScript->registerMetaTag(GxHtml::decode($this->controller->evento['name']), null, null, array('itemprop' => 'name'));
Yii::app()->clientScript->registerMetaTag(GxHtml::decode($this->controller->evento['name']), null, null, array('property' => 'og:description'));
Yii::app()->clientScript->registerMetaTag('website', null, null, array('property' => 'og:type'));
Yii::app()->clientScript->registerMetaTag('http://MyUrl.com' . Yii::app()->request->requestUri, null, null, array('property' => 'og:url'));
Yii::app()->clientScript->registerMetaTag('http://MyUrl.com' . $imageName, null, null, array('property' => 'og:image'));
Yii::app()->clientScript->registerMetaTag('image/png', null, null, array('property' => 'og:image:type'));
Yii::app()->clientScript->registerMetaTag('300', null, null, array('property' => 'og:image:width'));
Yii::app()->clientScript->registerMetaTag('300', null, null, array('property' => 'og:image:height'));
}
and this is what rendered on the page (i Paste just the header)
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<meta name="ROBOTS" content="index,follow" />
<meta name="GOOGLEBOT" content="INDEX, FOLLOW" />
<meta name="FAST-WebCrawler" content="index, follow" />
<meta name="Scooter" content="index, follow" />
<meta name="Slurp" content="index, follow" />
<meta name="REVISIT-AFTER" content="7 days" />
<meta name="distribution" content="global" />
<meta name="copyright" content="Copyright Sardegna Country – Servizi Turistici" />
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" href="/css/bootstrap.min.css"/>
<!-- Optional theme -->
<link rel="stylesheet" href="/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" href="/css/carousel.css"/>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
.mycaption{background-color:#3A3C3F;opacity:0.7;height:40px;width:1530px;position:absolute;top:450px;left:-100px;}
</style>
<meta name="description" content="Sardegna Country. Sassari, Ente Concerti Marialisa De Carolis, STAGIONE LIRICA 2014." />
<meta name="keywords" content="bunch,of,keywords" />
<meta property="og:title" content="Sassari, Ente Concerti Marialisa De Carolis, STAGIONE LIRICA 2014." />
<meta property="og:site_name" content="SardegnaCountry" />
<meta itemprop="description" content="Sassari, Ente Concerti Marialisa De Carolis, STAGIONE LIRICA 2014." />
<meta itemprop="name" content="Sassari, Ente Concerti Marialisa De Carolis, STAGIONE LIRICA 2014." />
<meta property="og:description" content="Sassari, Ente Concerti Marialisa De Carolis, STAGIONE LIRICA 2014." />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://sardegnacountry.com/eventi/scheda/id/555/categoria/manifestazioni" />
<meta property="og:image" content="http://sardegnacountry.com/images/eventi/4675-Teatro-comunale-di-Sassari.jpg" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="300" />
<meta property="og:image:height" content="300" />
<title>SardegnaCountry - Sassari, Ente Concerti Marialisa De Carolis, STAGIONE LIRICA 2014.</title>
</head>
everything seems fine but if I try to share the page all the dynamic parts of the meta tags seems to be ignored.
I’ve done this test:
#1) copy/paste the url to the Open Graph Object Debugger and clicked "Fetch new scrape info" --> result:
Meta Tag <meta property="og:title" content="" />
Meta Tag <meta property="og:site_name" content="SardegnaCountry" />
Meta Tag <meta property="og:description" content="" />
Meta Tag <meta property="og:type" content="website" />
Meta Tag <meta property="og:url" content="http://sardegnacountry.com/eventi/scheda/id/555/categoria/manifestazioni" />
Meta Tag <meta property="og:image" content="http://sardegnacountry.com/images/eventi/" />
Meta Tag <meta property="og:image:type" content="image/png" />
Meta Tag <meta property="og:image:width" content="300" />
Meta Tag <meta property="og:image:height" content="300" />
#2) in the action I’ve changed the line
Yii::app()->clientScript->registerMetaTag('http://MyUrl.com' . $imageName, null, null, array('property' => 'og:image'));
with
Yii::app()->clientScript->registerMetaTag('http://sardegnacountry.com/images/eventi/4675-Teatro-comunale-di-Sassari.jpg', null, null, array('property' => 'og:image'));
#3) Redo the point 2, whit the result that now open graph sees correctly the image url!
#4) I’ve tried to change in static string, the other not read properties and again, open graph debugger read them then.
I can’t figure out what i’m doing wrong,
Please can u help me?