<?php

use artbox\core\helpers\ImageHelper;
use artbox\core\helpers\Url;

/**
 * @var \common\models\blog\Article $model
 */
# значения вынесены, потому что эти данные нужны не только в самой картинке, а и для микроразметки
$imageWidth = 360;
$imageHeight = 240;
?>

<div class="blog-list-wr">
    <meta itemprop="datePublished" content="<?= date('d-m-Y', $model->created_at) ?>"/> <!-- ДАТА -->
    <div itemprop="dateModified" content="<?= date('d-m-Y', $model->updated_at) ?>"></div>

    <meta itemprop="headline" content="<?= $model->language->title ?>"/> <!-- ХХХ название статьи в H1 -->
    <div class="img-blog-list">
        <div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">
            <a href="<?= Url::to(['alias' => $model->alias]) ?>">
                <!--360x240-->

				<?php
				$alt = (isset($model->image->lang->attributes['alt'])) ? $model->image->lang->attributes['alt'] : '';
				$description = (isset($model->image->lang->attributes['description'])) ? $model->image->lang->attributes['description'] : '';
				?>
                <meta itemprop="url"
                      content="http://clinica.loc/storage/helper/17_m3OLnPXP_FqgNDCoOf0zpWi50UHSaOsm_cr_360_x_240_q84.jpg">

                <meta itemprop="height" content="44"/>

                <meta itemprop="width" content="54"/>
				<?= ImageHelper::set(($model->image) ? $model->image->getPath() : null)
					->cropResize(360, 240)
					->quality(84)
					->renderImage(['alt' => $alt, 'description' => $description]) ?>
            </a>
        </div>
        <meta itemprop="name" content="<?= Url::home(true); ?>">
    </div>
    <div class="blog-all-date-views">
        <div class="blog-date"><?= date('d.m.Y', $model->created_at) ?></div>
        <div class="blog-views-comments-ico">
            <div class="blog-comments-ico"><?= count($model->comments) ?></div>
            <div class="blog-views-ico"><?= $model->views ?></div>
        </div>
    </div>
    <div class="blog-list-link">
        <a href="<?= Url::to(['alias' => $model->language->alias]) ?>" itemprop="description">
            <span><?= $model->body_preview ?></span></a>
        <meta itemprop="name" content="<?= Url::home(true); ?>"/>
    </div>
	<?php if (!empty($model->tags)) { ?>
        <div class="blog-list-tags" itemtype="http://schema.org/Article" itemscope>
			<?php foreach ($model->tags as $tag) { ?>
                <a itemprop="mainEntityOfPage" href="<?= Url::to(['alias' => $tag->language->alias]) ?>"
                   itemprop="name"><?= $tag->title ?></a>
			<?php } ?>
        </div>
	<?php } ?>
    <div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">

        <meta itemprop="url"
              content="http://clinica.loc/storage/helper/17_m3OLnPXP_FqgNDCoOf0zpWi50UHSaOsm_cr_360_x_240_q84.jpg">

        <meta itemprop="height" content="675"/>

        <meta itemprop="width" content="900"/>
    </div>
</div>