From b14ef8490d7f0a6a56fbcdf7f4e97def172d9eb1 Mon Sep 17 00:00:00 2001 From: Ephraim-G Date: Mon, 7 Oct 2024 14:22:50 -0400 Subject: [PATCH] add addFilter method --- .eleventy.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.eleventy.js b/.eleventy.js index 3265982..777a0da 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -50,6 +50,12 @@ module.exports = function (config) { return DateTime.fromJSDate(dateObj, { zone: 'utc' }).toFormat('yyyy-LL-dd'); }); + // absoluteURL filter +config.addFilter('absoluteUrl', function(path) { + const baseUrl = process.env.BASEURL; + return new URL(path, baseUrl).href; +}); + // Get the first `n` elements of a collection. config.addFilter('head', (array, n) => { if (!Array.isArray(array) || array.length === 0) {