diff --git a/eleventy.config.js b/eleventy.config.js index 7108c90..b3b6d3f 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -412,6 +412,11 @@ export default function (eleventyConfig) { .replace(/^-+|-+$/g, ""); }); + eleventyConfig.addFilter("stripTrailingSlash", (url) => { + if (!url || typeof url !== "string") return url || ""; + return url.endsWith("/") ? url.slice(0, -1) : url; + }); + // Hash filter for cache busting - generates MD5 hash of file content eleventyConfig.addFilter("hash", (filePath) => { try {