diff --git a/.eleventy.js b/.eleventy.js index 92e1087..b53ad6f 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -40,12 +40,12 @@ module.exports = function (eleventyConfig) { eleventyConfig.addPassthroughCopy({ "src/static": "/" }); - eleventyConfig.addFilter("date_to_datetime", (obj) => { + eleventyConfig.addFilter("date_to_datetime", async (obj) => { const date = parseDate(obj); return date.toISOString(); }); - eleventyConfig.addFilter("date_formatted", (obj) => { + eleventyConfig.addFilter("date_formatted", async (obj) => { const date = parseDate(obj); const month = formatPart({ month: "short" }, date); @@ -55,18 +55,18 @@ module.exports = function (eleventyConfig) { const minutes = date.getUTCMinutes(); if (hours != 0 && minutes != 0) { - return `${month} ${day}, ${year} - ${hours}:${minutes} UTC`; } return `${month} ${day}, ${year}`; }); - eleventyConfig.addFilter('urlescape', str => { + eleventyConfig.addFilter('urlescape', async str => { return str.split('/').map(part => encodeURI(part)).join('/') }); - eleventyConfig.addFilter("related", function(obj) { + // TODO: possibly turn this into a post processing step instead of a filter (or at least make it a shortcode) + eleventyConfig.addFilter("related", async function(obj) { const post = this.ctx; const posts = this.ctx.collections.posts.map(post => post.data); diff --git a/src/_includes/components/bounce.js b/src/_includes/components/bounce.js index b876fe2..749c2b2 100644 --- a/src/_includes/components/bounce.js +++ b/src/_includes/components/bounce.js @@ -1,6 +1,6 @@ const cache = new Map(); -module.exports = ({ path, check_path = 'src/static/' + path, type = "css" }) => { +module.exports = async ({ path, check_path = 'src/static/' + path, type = "css" }) => { // caching hashes significantly speeds up build time var hash = undefined; if (cache.get(check_path)) { diff --git a/src/_includes/components/figure.js b/src/_includes/components/figure.js index fae6247..a1d7021 100644 --- a/src/_includes/components/figure.js +++ b/src/_includes/components/figure.js @@ -1,7 +1,12 @@ -module.exports = (md) => ({ src, alt, caption = '' }) => ` +module.exports = (md) => async ({ src, alt, caption = '', type = 'img' }) => `
- ${alt} + ${ + type == 'video' ? +`` : `${alt}` + }
${caption ? `
${md.renderInline(caption)}
` : ''}