xmitter-11ty/_includes/postslist.njk
Den McHenry 50ec3a7e5e
Add reversed attribute to posts list
Without CSS, the last post will be number 1. In browsers other than IE and Edge (where it's currently under consideration), the `reversed` attribute will match the effect of the CSS counter. I like putting the attribute first so it's clear that it's a particular kind of "ordered list: reversed."
2018-09-04 12:11:40 -07:00

15 lines
675 B
Plaintext

<ol reversed class="postlist" style="counter-reset: start-from {{ postslist.length + 1 }}">
{% for post in postslist | reverse %}
<li class="postlist-item{% if post.url == url %} postlist-item-active{% endif %}">
<a href="{{ post.url | url }}" class="postlist-link">{% if post.data.title %}{{ post.data.title }}{% else %}<code>{{ post.url }}</code>{% endif %}</a>
<span class="postlist-date">{{ post.date | readableDate }}</span>
{% for tag in post.data.tags %}
{%- if tag != "post" -%}
{% set tagUrl %}/tags/{{ tag }}/{% endset %}
<a href="{{ tagUrl | url }}" class="tag">{{ tag }}</a>
{%- endif -%}
{% endfor %}
</li>
{% endfor %}
</ol>