28 lines
No EOL
1.3 KiB
Text
28 lines
No EOL
1.3 KiB
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.page.inputPath | pathOnly }}/{{item.data.cover}}" alt="" sizes="(min-width: 60rem) calc(0.5 * var(--content-width)), var(--content-width)">
|
|
{% endif %}
|
|
<a class="collection-itemTitle" href="{{item.url}}" {% if item.url.startsWith("http") %}target="_blank"{% endif %}>{{item.data.title}}</a>
|
|
<div class="collection-itemData">
|
|
{%- if item.data.date -%}
|
|
<span>{{item.data.date | formatDate("MMMM DD, YYYY") }}</span>
|
|
{%- endif -%}
|
|
<span>{{ tagList(item.data.tags.slice(1)) }}</span>
|
|
</div>
|
|
<p class="collection-itemDescription">{{item.data.description | safe}}</p>
|
|
</li>
|
|
{%- endif -%}
|
|
{%- if (limit !== 0 and loop.index == limit + 1) -%}
|
|
<li>
|
|
<a class="collection-itemTitle" href="/{{tagName}}/">More {{tagName}}…</a>
|
|
</li>
|
|
{%- endif -%}
|
|
{%- endfor -%}
|
|
</ul>
|
|
{% endmacro %} |