{block name='blog-preview'}
    {$lazyLoadImages=$lazyLoadImages|default:true}
    {et_isShopVersionAtLeast value="5.2.0-beta" assign='shopIsAtLeast52'}
    {et_isShopVersionAtLeast value="5.5.0-rc.1" assign='shopIsAtLeast55'}
    {$title = $newsItem->getTitle()}
    <div itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting" class="newsbox blog-preview">
        <meta itemprop="mainEntityOfPage" content="{$newsItem->getURL()}">

        {* Blog Post Header *}
        {block name='blog-preview-news-header'}
            <div class="newsbox-header">
                {* Post Thumbnail *}
                {if !empty($newsItem->getPreviewImage())}
                    {block name='blog-preview-news-image'}
                        <a href="{$newsItem->getURL()}" title="{$title|strip_tags|escape:'html'}" tabindex="-1" class="preview-image">
                            <div class="newsbox-image">
                                {include file='snippets/image.tpl'
                                    item=$newsItem
                                    square=false
                                    alt="{$title|strip_tags|escape:'html'} - {$newsItem->getMetaTitle()|strip_tags|escape:'html'}"}
                            </div>
                            <meta itemprop="image" content="{$imageBaseURL}{$newsItem->getPreviewImage()}">
                        </a>
                    {/block}
                {/if}
            </div>
        {/block}

        {* Blog Post Body *}
        {block name='blog-preview-news-body'}
            <div class="newsbox-body">
                <div class="row">
                    {* Author / Date *}
                    <div class="col col-8 blog-preview-author">
                        {assign var=dDate value=$newsItem->getDateValidFrom()->format('Y-m-d')}
                        {block name='blog-preview-author'}
                            {if $newsItem->getAuthor() !== null}
                                <div class="newsbox-author">
                                    {block name='blog-preview-include-author'}
                                        {include file='snippets/author.tpl' oAuthor=$newsItem->getAuthor() showModal=false lazyLoadImages=$lazyLoadImages}
                                    {/block}
                                </div>
                            {else}
                                <div itemprop="author publisher" itemscope itemtype="https://schema.org/Organization" class="d-none">
                                    <meta itemprop="name" content="{$meta_publisher|strip_tags|escape:'html'}" />
                                    <meta itemprop="url" content="{$ShopURL}">
                                    <meta itemprop="logo" content="{$ShopLogoURL}">
                                </div>
                            {/if}
                            <meta itemprop="dateModified" content="{$newsItem->getDateCreated()->format('Y-m-d')}" />
                            <meta itemprop="datePublished" content="{$dDate}" />
                            <span class="align-middle">{$newsItem->getDateValidFrom()->format('d.m.Y')}</span>
                        {/block}
                    </div>

                    {* Comments *}
                    <div class="col col-auto blog-preview-comment">
                        {if isset($Einstellungen.news.news_kommentare_nutzen) && $Einstellungen.news.news_kommentare_nutzen === 'Y'}
                            {block name='blog-preview-comments'}
                                <a href="{$newsItem->getURL()|cat:'#comments'}" class="newxbox-comments-link link-discreet">
                                    <span class="{et_getIcon key="comments"}"></span>
                                    {if !$shopIsAtLeast55}
                                        <span class="sr-only">
                                            {if $newsItem->getCommentCount() === 1}
                                                {lang key='newsComment' section='news'}
                                            {else}
                                                {lang key='newsComments' section='news'}
                                            {/if}
                                        </span>
                                    {/if}
                                    <meta itemprop="commentCount" content="{$newsItem->getCommentCount()}">
                                    <span>
                                        {$newsItem->getCommentCount()}
                                        {if $shopIsAtLeast52 && $newsItem->getChildCommentsCount() && $Einstellungen.news.news_kommentare_anzahl_antwort_kommentare_anzeigen === 'Y'}
                                            ({$newsItem->getChildCommentsCount()})
                                        {/if}
                                    </span>
                                    {if $shopIsAtLeast55}
                                        <span class="sr-only">
                                            {if $newsItem->getCommentCount() === 1}
                                                {lang key='newsCommentForPosting' section='news' printf=$title}
                                            {else}
                                                {lang key='newsCommentsForPosting' section='news' printf=$title}
                                            {/if}
                                        </span>
                                    {/if}
                                </a>
                            {/block}
                        {/if}
                    </div>
                </div>

                {* Headline *}
                {block name='blog-preview-heading'}
                    <a itemprop="url" href="{$newsItem->getURL()}" title="{$title|strip_tags|escape:'html'}" class="newsbox-headline link-discreet">
                        <span itemprop="headline">{$title}</span>
                    </a>
                {/block}

                {* Description *}
                {block name='blog-preview-description'}
                    <p itemprop="description" class="newsbox-description">
                        {$newsItemStripped=$newsItem->getPreview()|strip_tags}
                        {if strlen($newsItemStripped) > 0}
                            {$newsItemStripped}
                        {else}
                            {$newsItem->getContent()|strip_tags|truncate:200:''}
                        {/if}
                    </p>
                {/block}
            </div>
        {/block}

        {* Footer *}
        {block name='blog-preview-news-footer'}
            <div class="newsbox-footer">
                <a href="{$newsItem->getURL()}" title="{$title|strip_tags|escape:'html'}" class="newsbox-link link-discreet">
                    {lang key='moreLink' section='news'}
                    <i class="{et_getIcon key="navigationNext"} icon-mr-2"></i>
                </a>
            </div>
        {/block}
    </div>
{/block}
