Commit 28e5312e5983e344e5cc7285babe730cdc5d1e38
1 parent
7f415050
Настройка аналитики и целей
Переделал микроразметку для логотипа и комментариев
Showing
3 changed files
with
102 additions
and
28 deletions
Show diff stats
frontend/views/blog/_article.php
| ... | ... | @@ -6,28 +6,14 @@ |
| 6 | 6 | /** |
| 7 | 7 | * @var \common\models\blog\Article $model |
| 8 | 8 | */ |
| 9 | - | |
| 9 | +# значения вынесены, потому что эти данные нужны не только в самой картинке, а и для микроразметки | |
| 10 | +$imageWidth=360; | |
| 11 | +$imageHeight=240; | |
| 10 | 12 | ?> |
| 11 | 13 | |
| 12 | -<div class="blog-list-wr"> | |
| 13 | - <div class="img-blog-list"> | |
| 14 | - <a href="<?=Url::to(['alias' => $model->language->alias])?>"> | |
| 15 | - <!--360x240--> | |
| 16 | 14 | |
| 17 | 15 | |
| 18 | - <?=ImageHelper::set(($model->image) ? $model->image->getPath() : null) | |
| 19 | - ->cropResize(360, 240) | |
| 20 | - ->quality(84) | |
| 21 | - ->renderImage(['alt'=>$model->language->attributes['title'],'title'=>$model->language->attributes['title']])?> | |
| 22 | - </a> | |
| 23 | - </div> | |
| 24 | - <div class="blog-all-date-views"> | |
| 25 | - <div class="blog-date"><?=date('d.m.Y', $model->created_at)?></div> | |
| 26 | - <div class="blog-views-comments-ico"> | |
| 27 | - <div class="blog-comments-ico"><?=count($model->comments)?></div> | |
| 28 | - <div class="blog-views-ico"><?=$model->views?></div> | |
| 29 | - </div> | |
| 30 | - </div> | |
| 16 | + | |
| 31 | 17 | <div class="blog-list-link"><a href="<?=Url::to(['alias' => $model->language->alias])?>"> |
| 32 | 18 | <span><?=$model->body_preview?></span></a></div> |
| 33 | 19 | <?php if (!empty($model->tags)){?> |
| ... | ... | @@ -37,4 +23,69 @@ |
| 37 | 23 | <?php } ?> |
| 38 | 24 | </div> |
| 39 | 25 | <?php } ?> |
| 40 | -</div> | |
| 26 | + | |
| 27 | + | |
| 28 | +<div itemtype="http://schema.org/Article" itemscope class="blog-list-wr"> | |
| 29 | + | |
| 30 | + <div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject" class="img-blog-list"> | |
| 31 | + | |
| 32 | + <meta itemprop="url" content="<?=($model->image) ? $model->image->getPath() : null;?>"> | |
| 33 | + <meta itemprop="height" content="<?=$imageWidth;?>"/> | |
| 34 | + <meta itemprop="width" content="<?=$imageHeight;?>"/> | |
| 35 | + | |
| 36 | + <a href="<?=Url::to(['alias' => $model->language->alias])?>"> | |
| 37 | + <!--360x240--> | |
| 38 | + | |
| 39 | + | |
| 40 | + <?=ImageHelper::set(($model->image) ? $model->image->getPath() : null) | |
| 41 | + ->cropResize($imageWidth, $imageHeight) | |
| 42 | + ->quality(84) | |
| 43 | + ->renderImage(['alt'=>$model->language->attributes['title'],'title'=>$model->language->attributes['title']])?> | |
| 44 | + </a> | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + </div> | |
| 49 | + | |
| 50 | + <div class="blog-all-date-views"> | |
| 51 | + <metacontent="<?=date('d.m.Y', $model->created_at);?>"/> | |
| 52 | + <div itemprop="datePublished" class="blog-date"><?=date('d.m.Y', $model->created_at)?></div> | |
| 53 | + <div class="blog-views-comments-ico"> | |
| 54 | + <div class="blog-comments-ico"><?=count($model->comments)?></div> | |
| 55 | + <div class="blog-views-ico"><?=$model->views?></div> | |
| 56 | + </div> | |
| 57 | + </div> | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + <meta itemprop="headline" content="XXX"/> где ХХХ название статьи в H1 | |
| 66 | + | |
| 67 | + <div itemprop="publisher" itemscope itemtype="https://schema.org/Organization"> | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + <meta itemprop="name" content="НАЗВАНИЕ САЙТА"> | |
| 72 | + | |
| 73 | + </div> | |
| 74 | + | |
| 75 | + <div itemprop="author" itemscope itemtype="https://schema.org/Person"> | |
| 76 | + | |
| 77 | + <meta itemprop="name" content="НАЗВАНИЕ САЙТА"/> | |
| 78 | + | |
| 79 | + </div> | |
| 80 | + | |
| 81 | + <p itemprop="description">ОПИСАНИЕ</p> | |
| 82 | + | |
| 83 | + <div itemprop="image" itemscope itemtype="https://schema.org/ImageObject"> | |
| 84 | + | |
| 85 | + <meta itemprop="url" content="КАРТИНКА"> | |
| 86 | + | |
| 87 | + <meta itemprop="height" content="675"/> | |
| 88 | + | |
| 89 | + <meta itemprop="width" content="900"/> | |
| 90 | + </div> | |
| 91 | +</div> | |
| 41 | 92 | \ No newline at end of file | ... | ... |
frontend/views/layouts/main.php
| ... | ... | @@ -79,15 +79,35 @@ |
| 79 | 79 | <!DOCTYPE html > |
| 80 | 80 | <html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html" lang="<?= \Yii::$app->language ?>"> |
| 81 | 81 | <head> |
| 82 | - | |
| 82 | + <!-- Global site tag (gtag.js) - Google Analytics --> | |
| 83 | + <script async src="https://www.googletagmanager.com/gtag/js?id=UA-120861020-1"></script> | |
| 84 | + <script> | |
| 85 | + window.dataLayer = window.dataLayer || []; | |
| 86 | + function gtag(){dataLayer.push(arguments);} | |
| 87 | + gtag('js', new Date()); | |
| 88 | + | |
| 89 | + gtag('config', 'UA-120861020-1'); | |
| 90 | + </script> | |
| 91 | + <!-- Google Tag Manager --> | |
| 92 | + <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
| 93 | + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
| 94 | + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
| 95 | + 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | |
| 96 | + })(window,document,'script','dataLayer','GTM-N6R7982');</script> | |
| 97 | + <!-- End Google Tag Manager --> | |
| 83 | 98 | <meta charset="<?= \Yii::$app->charset ?>"> |
| 84 | 99 | <meta name="viewport" content="width=device-width"> |
| 85 | 100 | <link type="image/x-icon" href="favicon.ico" rel="icon"> |
| 86 | 101 | <?= Html::csrfMetaTags() ?> |
| 87 | 102 | <title><?=Html::encode($seo->title)?></title> |
| 103 | + <div class="row" itemscope itemtype="http://schema.org"> | |
| 88 | 104 | <?php $this->head() ?> |
| 89 | 105 | </head> |
| 90 | 106 | <body id="body"> |
| 107 | + <!-- Google Tag Manager (noscript) --> | |
| 108 | + <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N6R7982" | |
| 109 | + height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> | |
| 110 | + <!-- End Google Tag Manager (noscript) --> | |
| 91 | 111 | <?php $this->beginBody() ?> |
| 92 | 112 | <div class="transition-loader"> |
| 93 | 113 | <div class="transition-loader-inner"> |
| ... | ... | @@ -105,7 +125,7 @@ |
| 105 | 125 | <div class="row"> |
| 106 | 126 | <div class="col-xs-7 col-sm-3 col-md-2 col-lg-2 logo-wrapp"> |
| 107 | 127 | |
| 108 | - <a | |
| 128 | + <a itemprop="url" content="<?=\Yii::$app->homeUrl;?>?" | |
| 109 | 129 | <?php if(DefaultUrl::current()!=='/site/index'): ?> |
| 110 | 130 | href= "<?php echo \frontend\helpers\Url::home(); ?>"> |
| 111 | 131 | <?php else: ?> |
| ... | ... | @@ -115,7 +135,7 @@ |
| 115 | 135 | <?php |
| 116 | 136 | if ($settings->logo != null){ |
| 117 | 137 | echo |
| 118 | - "<img src='/storage/logo/".$settings->logo."' alt='".\Yii::t('app','ABC short')."' | |
| 138 | + "<img itemprop='logo' src='/storage/logo/".$settings->logo."' alt='".\Yii::t('app','ABC short')."' | |
| 119 | 139 | title='".\Yii::t('app','ABC short')."' |
| 120 | 140 | >"; |
| 121 | 141 | }else{ |
| ... | ... | @@ -125,7 +145,8 @@ |
| 125 | 145 | [ |
| 126 | 146 | 'alt' => $settings->name, |
| 127 | 147 | #'alt'=>\Yii::t('app','ABC short'), |
| 128 | - 'title'=>\Yii::t('app','ABC short') | |
| 148 | + 'title'=>\Yii::t('app','ABC short'), | |
| 149 | + 'itemprop'=>"logo" | |
| 129 | 150 | ] |
| 130 | 151 | ); |
| 131 | 152 | } | ... | ... |
frontend/views/site/_comment.php
| ... | ... | @@ -3,8 +3,10 @@ |
| 3 | 3 | * @var \common\models\Comment $model; |
| 4 | 4 | */ |
| 5 | 5 | ?> |
| 6 | -<div class="service-comments style"> | |
| 7 | - <div class="style comments-h-autor"><?=$model->name?></div> | |
| 8 | - <div class="style comments-h-text"><?=$model->comment?></div> | |
| 9 | - <div class="style comments-h-date"><?=date('d.m.Y', $model->created_at)?></div> | |
| 10 | -</div> | |
| 6 | + | |
| 7 | + | |
| 8 | +<div itemprop="review" class="service-comments style" itemscope="itemscope" itemtype="http://schema.org/Review"> | |
| 9 | + <div itemprop="author" class="style comments-h-autor"><?=$model->name;?></div> | |
| 10 | + <div itemprop="description" class="style comments-h-text"><?=$model->comment;?></div> | |
| 11 | + <div itemprop="datePublished" class="style comments-h-date" ><?=date('d.m.Y', $model->created_at);?></div> | |
| 12 | +</div> | |
| 11 | 13 | \ No newline at end of file | ... | ... |