joshua.seigler.net/site/_includes/components/collectionList.njk
2025-07-01 02:54:00 -04:00

26 lines
No EOL
948 B
Text

{%- from "components/tagList.njk" import tagList with context -%}
{% macro collectionList(tagName, limit=0) %}
<ul class="collection">
{%- for item in collections[tagName] | reverse -%}
{%- if (limit === 0 or loop.index <= limit) -%}
<li>
{% if item.data.cover %}
<img class="collection-cover" src="{{ item.data.cover | url }}">
{% endif %}
<a href="{{item.url}}">{{item.data.title}}</a>
{%- if item.data.date -%}
<aside>{{item.data.date | formatDate("MMMM DD, YYYY") }}</aside>
{%- endif -%}
<aside>{{ tagList(item.data.tags.slice(1)) }}</aside>
<p>{{item.data.description | safe}}</p>
</li>
{%- endif -%}
{%- if (limit !== 0 and loop.index == limit + 1) -%}
<li>
<a href="/{{tagName}}/">More {{tagName}}&hellip;</a>
</li>
{%- endif -%}
{%- endfor -%}
</ul>
{% endmacro %}