Add datetime attribute to time elements

This commit is contained in:
Lewis Dale 2023-11-28 21:13:07 +00:00
parent b0bc736a7e
commit fb94864b15
3 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@ pagination:
{% for item in pagination.items %}
<li class="stack-xs">
<h2><a href="/post/{{ item.slug }}">{{ item.title.rendered | safe }}</a></h2>
<time class="block">{{ item.date | parseDate | dateDisplay }}</time>
<time class="block" datetime="{{ item.date }}">{{ item.date | parseDate | dateDisplay }}</time>
{{ item.excerpt.rendered | safe }}
<a href="/post/{{ item.slug }}" class="inline-block">Read more</a>
</li>

View File

@ -17,7 +17,7 @@ eleventyComputed:
{% for item in tag.posts %}
<li class="stack-xs">
<h2><a href="/post/{{ item.slug }}">{{ item.title.rendered | safe }}</a></h2>
<time class="block">{{ item.date | parseDate | dateDisplay }}</time>
<time datetime="{{ post.date }}" class="block">{{ item.date | parseDate | dateDisplay }}</time>
{{ item.excerpt.rendered | safe }}
<a href="/post/{{ item.slug }}" class="inline-block">Read more</a>
</li>

View File

@ -26,7 +26,7 @@ layout: base.njk
<ul class="stack-2xs" role='list'>
{% for post in posts | take(3) %}
<li><a href="/post/{{ post.slug }}">{{ post.title.rendered | safe }}</a> <time>{{ post.date | dateDisplay }}</time></li>
<li><a href="/post/{{ post.slug }}">{{ post.title.rendered | safe }}</a> <time datetime="{{ post.date }}">{{ post.date | dateDisplay }}</time></li>
{% endfor %}
</ul>