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) }