Skip to content

Commit

Permalink
Merge pull request #170 from Vortexmind/Vortexmind-patch-1
Browse files Browse the repository at this point in the history
Update index.js
  • Loading branch information
Vortexmind authored Nov 4, 2024
2 parents 9f2b58b + 09de050 commit 0b88297
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
}
Expand Down

0 comments on commit 0b88297

Please sign in to comment.