V2_Category_EntrySummary
{% set categoryEntrySummary = module('V2_Category_EntrySummary', null, {
bid: null,
cid: null,
uid: null,
limit: null,
keyword: null,
tag: [],
field: null,
order: null,
start: '1000-01-01 00:00:00',
end: '9999-12-31 23:59:59'
}) %}
{% if categoryEntrySummary.items is not empty %}
{% macro renderCategories(categories) %}
<div>
{% for category in categories %}
<h3 class="acms-heading">
<a href="{{ category.url }}">{{ category.name }}({{ category.depth }}階層)</a>
</h3>
<div class="acms-cssgrid acms-g-cols-1 acms-g-cols-md-3">
{% for entry in category.entries %}
<div>
<a class="acms-thumbnail" href="{{ entry.url }}">
{% if entry.mainImage %}
<img
src="{{ entry.mainImage.path|resizeImg(300) }}"
alt="{{ entry.mainImage.alt }}"
class="acms-img-responsive"
width="{{ entry.mainImage.width }}"
height="{{ entry.mainImage.height }}"
loading="lazy"
decoding="async"
>
{% else %}
<img
src="/images/default/noimage.gif"
alt=""
class="acms-img-responsive"
width="{noImgX}"
height="{noImgY}"
loading="lazy"
decoding="async"
>
{% endif %}
<h4>{{ entry.title }}</h4>
<p>{{ entry.summary }}</p>
</a>
</div>
{% endfor %}
</div>
{% if category.children is defined %}
{{ _self.renderCategories(category.children) }}
{% endif %}
{% endfor %}
</div>
{% endmacro %}
<div class="acms-margin-bottom-medium">
{{ include('/admin/module/setting.twig', { moduleInfo: categoryEntrySummary.moduleInfo }) }}
{{ _self.renderCategories(categoryEntrySummary.items) }}
</div>
{% endif %}