From 34ef76515c9ac00c5bd0381e90df95f790f0fd2a Mon Sep 17 00:00:00 2001 From: nycki Date: Thu, 21 Aug 2025 19:00:09 -0700 Subject: [PATCH] special case for tag --- _config/relative-links.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/_config/relative-links.js b/_config/relative-links.js index ee6cd4a..d119e6e 100644 --- a/_config/relative-links.js +++ b/_config/relative-links.js @@ -56,4 +56,19 @@ export default function (eleventyConfig) { priority: -1, // run last last (after PathToUrl) }, ); + + eleventyConfig.addTransform('relative-svg', function(content) { + if (!(this.page.outputPath || '').endsWith('.html')) { + return content; + } + const fromDir = this.url.endsWith("/") ? this.url : path.dirname(this.url); + + return content.replaceAll(/ { + let relativePath = path.relative(fromDir, matchedUrl); + if (!relativePath.startsWith(".")) { + relativePath = "./" + relativePath; + } + return `