Commit 642cabb944945cdd016199cb02b3e4ff0cee8890

Authored by alex
1 parent 4ca4188e

микроразметка тест 6

Showing 1 changed file with 5 additions and 3 deletions   Show diff stats
frontend/controllers/BlogController.php
... ... @@ -5,6 +5,7 @@
5 5 use common\models\blog\Article;
6 6 use common\models\blog\Category;
7 7 use common\models\blog\Tag;
  8 + use frontend\helpers\Url;
8 9 use yii\data\ActiveDataProvider;
9 10 use yii\db\ActiveQuery;
10 11 use yii\helpers\ArrayHelper;
... ... @@ -100,7 +101,10 @@
100 101 "headline" => "Article headline",
101 102 "datePublished" => date('d-m-Y', $model->created_at),
102 103 "dateModified" => date('d-m-Y', $model->created_at),
103   -
  104 + 'image' => [
  105 + # 'https://google.com/logo.jpg'
  106 + ($model->image) ? Yii::$app->request->hostInfo . $model->image->getPath() : 'https://google.com/logo.jpg'
  107 + ],
104 108  
105 109 "author" => [
106 110 "@type" => "Person",
... ... @@ -118,8 +122,6 @@
118 122 ]
119 123 ];
120 124  
121   - if ($model->image) $resultMicrodata['image'] = $model->image->getPath();
122   -
123 125  
124 126 $resultMicrodata = new MicrodataFabric();
125 127 $resultMicrodata = $resultMicrodata::createJsonFromArticle($jsonLdMicrodata)->toJson();
... ...