Show day on post page

This commit is contained in:
Zach Leatherman 2022-08-15 15:00:08 -05:00
parent df6a44bf80
commit 57e1a3d262
2 changed files with 3 additions and 3 deletions

View File

@ -27,8 +27,8 @@ module.exports = function(eleventyConfig) {
errorMode: "allow-fallback", errorMode: "allow-fallback",
}); });
eleventyConfig.addFilter("readableDate", dateObj => { eleventyConfig.addFilter("readableDate", (dateObj, format = "dd LLLL yyyy") => {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat("LLLL yyyy"); return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat(format);
}); });
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string

View File

@ -2,7 +2,7 @@
{% for post in postslist | reverse %} {% for post in postslist | reverse %}
<li class="postlist-item{% if post.url == url %} postlist-item-active{% endif %}"> <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> <a href="{{ post.url | url }}" class="postlist-link">{% if post.data.title %}{{ post.data.title }}{% else %}<code>{{ post.url }}</code>{% endif %}</a>
<time class="postlist-date" datetime="{{ post.date | htmlDateString }}">{{ post.date | readableDate }}</time> <time class="postlist-date" datetime="{{ post.date | htmlDateString }}">{{ post.date | readableDate("LLLL yyyy") }}</time>
</li> </li>
{% endfor %} {% endfor %}
</ol> </ol>