From e5f4077bebb45b71042736aa588c8c8317886c29 Mon Sep 17 00:00:00 2001 From: David Martin Date: Fri, 8 Nov 2024 17:12:56 +0000 Subject: [PATCH] Add image links to original image Signed-off-by: David Martin --- .eleventy.js | 2 ++ eleventy.config.images.js | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.eleventy.js b/.eleventy.js index 036d48b..476e74d 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -16,6 +16,8 @@ module.exports = function(eleventyConfig) { eleventyConfig.addPassthroughCopy("src/.well-known"); + eleventyConfig.addPassthroughCopy("src/blog/**/*.png"); + let markdownItOptions = { html: true, breaks: true, diff --git a/eleventy.config.images.js b/eleventy.config.images.js index 7f632db..67e1e7a 100644 --- a/eleventy.config.images.js +++ b/eleventy.config.images.js @@ -26,10 +26,13 @@ module.exports = function(eleventyConfig) { // Warning: Avif can be resource-intensive so take care! let formats = ["avif", "webp", "auto"]; let input; + let originalSrc; if(isFullUrl(src)) { input = src; + originalSrc = src; } else { input = relativeToInputPath(this.page.inputPath, src); + originalSrc = '.' + src; // passthrough copy puts imags 1 level up } let metadata = await eleventyImage(input, { @@ -46,6 +49,8 @@ module.exports = function(eleventyConfig) { decoding: "async", }; - return eleventyImage.generateHTML(metadata, imageAttributes); + let imageHtml = eleventyImage.generateHTML(metadata, imageAttributes); + + return `${imageHtml}`; }); };