chug chug, working on post formatting and tag pages
This commit is contained in:
19
_config/filters.js
Normal file
19
_config/filters.js
Normal file
@ -0,0 +1,19 @@
|
||||
import { DateTime } from "luxon";
|
||||
|
||||
export default function(eleventyConfig) {
|
||||
/* Human-readable dates */
|
||||
eleventyConfig.addFilter("readableDate", (dateObj, format, zone) => {
|
||||
return DateTime.fromJSDate(dateObj, { zone: zone || "utc" })
|
||||
.toLocaleString(DateTime.DATE_FULL);
|
||||
});
|
||||
|
||||
/* For <time> elements */
|
||||
eleventyConfig.addFilter("htmlDateString", (dateObj) => {
|
||||
return DateTime.fromJSDate(dateObj, { zone: "utc" }).toFormat('yyyy-LL-dd');
|
||||
});
|
||||
|
||||
/* Filter out structural tags */
|
||||
eleventyConfig.addFilter("removeBasicTags", (tags) => {
|
||||
return tags.filter(tag => ["all", "posts", "gallery", "reference", "tagPagination"].indexOf(tag) === -1);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user