<?php
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Blog Pro for Magento 2
 */
/** @var \Amasty\Blog\Block\Content\Lists $block */

$collection = $block->getCollection();
?>

<div class="amblog-grid-wrap amblog-post-wrap">
    <?php if ($collection && $collection->getSize()): ?>
        <?php foreach ($collection as $post): ?>
            <div class="list-item">
                <h3>
                    <a class="amblog-title" href="<?= $block->escapeUrl($post->getUrl()); ?>"
                       title="<?= $block->escapeHtml($post->getTitle()); ?>">
                        <?= $block->escapeHtml($post->getTitle()); ?>
                    </a>
                </h3>

                <?php if ($post->getListThumbnailSrc()): ?>
                    <div class="amp-img-container">
                        <a href="<?= $block->escapeUrl($post->getUrl()); ?>"
                           title="<?= $block->escapeHtml($post->getTitle()); ?>">
                            <amp-img alt="<?= $block->escapeHtml($post->getThumbnailAlt()); ?>"
                                     src="<?= $block->escapeUrl($post->getListThumbnailSrc()); ?>"
                                     layout="fill">
                            </amp-img>
                        </a>
                    </div>
                <?php endif; ?>

                <div class="post-header">
                    <?= $block->getAmpHeaderHtml($post); ?>
                </div>

                <div class="short-content">
                    <?= /* @noEscape */ $post->getShortContent(); ?>
                </div>

                <div class="amblog-post-tags">
                    <div class="amblog-categories">
                        <?= $block->getCategoriesHtml($post, true); ?>
                    </div>
                    <div class="amblog-tags">
                        <?= $block->getTagsHtml($post, true); ?>
                    </div>
                </div>

                <a class="button am-readmore" href="<?= $block->escapeUrl($block->getReadMoreUrl($post)); ?>"
                   title="<?= $block->escapeHtml(__("Read More")); ?>">
                    <?= $block->escapeHtml(__("Read More")); ?>
                </a>
            </div>
        <?php endforeach; ?>
        <div class="amblog-toolbar">
            <?= $block->getToolbarHtml(true); ?>
        </div>
    <?php else: ?>
        <p class="notice">
            <?= $block->escapeHtml(__("Your search returned no results")); ?>
        </p>
    <?php endif; ?>
</div>
