This commit is contained in:
inherentlee committed 2026-09-24 11:46:30 -07:00
1 parent 8d3a225fae
commit f610230891
6 files changed
+28 -5

No files matched your search

+6 -1
View File
@@ -18,13 +18,18 @@ export default function (eleventyConfig) {
return collection.slice(0, n); return collection.slice(0, n);
}); });
eleventyConfig.addFilter("inThePast", (dateString) => {
if (DateTime.fromISO(dateString) < DateTime.now()) return true;
return false;
});
eleventyConfig.addFilter("dateStringsEqual", (dateString1, dateString2) => { eleventyConfig.addFilter("dateStringsEqual", (dateString1, dateString2) => {
const date1 = DateTime.fromISO(dateString1); const date1 = DateTime.fromISO(dateString1);
const date2 = DateTime.fromISO(dateString2); const date2 = DateTime.fromISO(dateString2);
if ((date1.hasSame(date2, "year") && date1.hasSame(date2, "month")) && date1.hasSame(date2, "day")) if ((date1.hasSame(date2, "year") && date1.hasSame(date2, "month")) && date1.hasSame(date2, "day"))
return true; return true;
else return false; return false;
}); });
/* For <time> elements */ /* For <time> elements */
+13
View File
@@ -0,0 +1,13 @@
---
layout: page.njk
---
<p>
{% if date | inThePast %}
Occurred at <time datetime="{{ date | htmlDateString }}">{{ date | readableDate }}</time>
{% else %}
Occuring at <time datetime="{{ date | htmlDateString }}">{{ date | readableDate }}</time>
{% endif %}
</p>
{{ content | safe }}
+6
View File
@@ -10,6 +10,12 @@ layout: page.njk
<p>Updated on <time datetime="{{ dateUpdated | htmlDateString }}">{{ dateUpdated | readableDate }}</time></p> <p>Updated on <time datetime="{{ dateUpdated | htmlDateString }}">{{ dateUpdated | readableDate }}</time></p>
{% endif %} {% endif %}
<ul>
{% for tag in tags %}
<li>{{ tag }}</li>
{% endfor %}
</ul>
<img src="{{ image.src }}" alt="{{ image.alt }}"> <img src="{{ image.src }}" alt="{{ image.alt }}">
{{ content | safe }} {{ content | safe }}
+3
View File
@@ -0,0 +1,3 @@
export default {
layout: "event.njk",
};
-2
View File
@@ -1,8 +1,6 @@
--- ---
title: Future Event title: Future Event
date: '2027-12-31T12:00:00-08:00' date: '2027-12-31T12:00:00-08:00'
image: null
tags: null
___mb_schema: /.mattrbld/schemas/event.json ___mb_schema: /.mattrbld/schemas/event.json
--- ---
This will happen in the future. This will happen in the future.
-2
View File
@@ -1,8 +1,6 @@
--- ---
title: Past event title: Past event
date: '2026-09-01T12:00:00-07:00' date: '2026-09-01T12:00:00-07:00'
image: null
tags: null
___mb_schema: /.mattrbld/schemas/event.json ___mb_schema: /.mattrbld/schemas/event.json
--- ---
This has already happened. This has already happened.