From 09de050fd42b6849aad7f575977f8e378c52cfed Mon Sep 17 00:00:00 2001 From: Paolo Tagliaferri Date: Mon, 4 Nov 2024 14:49:31 +0000 Subject: [PATCH] Update index.js --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index c9f8d2d5..8a1c8e33 100644 --- a/index.js +++ b/index.js @@ -14,6 +14,7 @@ const CDN_IMG_SELECTORS = [ 'feature-image', 'author-profile-image', ] +const RELATIVE_CONTENT_PREFIX = ENV_RELATIVE_CONTENT_PREFIX || '/content/images/' class ElementHandler { element(element) { @@ -37,7 +38,7 @@ class ElementHandler { // If image is loaded from local content, rewrite to pull from CDN if ( imgSrc.startsWith(ENV_LOCAL_CONTENT_URL) || - imgSrc.startsWith(ENV_RELATIVE_CONTENT_PREFIX) + imgSrc.startsWith(RELATIVE_CONTENT_PREFIX) ) { element.setAttribute('src', ENV_CDN_FETCH_URL + imgSrc) }