Show day on post page
This commit is contained in:
parent
df6a44bf80
commit
57e1a3d262
@ -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
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user