{% set blogs = repository('Plugin\\CMBlogPro\\Entity\\Blog').getList() %}
{% set count = 0 %}
{% if blogs is defined and blogs|length > 0 %}
{% for blog in blogs %}
{% if count < maxCount %}
{# 特定カテゴリを含む ∨ 含まない処理 #}
{% set isInclude = false %}
{% set isExclude = true %}
{% if includeCategories is empty %}
{% set isInclude = true %}
{% else %}
{% for blogCategory in blog.BlogCategories %}
{% if blogCategory.CategoryId in includeCategories %}
{% set isInclude = true %}
{% endif %}
{% endfor %}
{% endif %}
{% if excludeCategories is empty %}
{% else %}
{% for blogCategory in blog.BlogCategories %}
{% if blogCategory.CategoryId in excludeCategories %}
{% set isExclude = false %}
{% endif %}
{% endfor %}
{% endif %}
{% if isInclude == true and isExclude == true %}
{% set count = count + 1 %}
<div class="home__news-item">
<a href="{{ url('news_detail/{id}', { 'id': blog.slug ? blog.slug : blog.id }) }}">
<div class="home__news-date">
{{ blog.release_date|date('Y年m月d日')|trans }}
</div>
<div class="home__news-title">
{{ blog.title|trans }}
</div>
<div class="home__news-detail">
<span>{{ 'もっと見る'|trans }}</span>
</div>
</a>
</div>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}