Skip to content

Commit

Permalink
image src determiner
Browse files Browse the repository at this point in the history
  • Loading branch information
bonomite committed Apr 18, 2024
1 parent f48c142 commit 54b2a6a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions v2/src/components/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ export const cmsSources = {

// determines the CMS source of an image
export const getCmsSource = (src) => {
if (src.includes('media.npr.org')) {
return cmsSources.NPR
} else if (src.includes('media.wnyc.org')) {
return cmsSources.PUBLISHER
} else if (src.includes('nypr.digital')) {
// if src is all just numbers, it's a wagtail image. using the domain for the others
if (/^\d+$/.test(src)) {
return cmsSources.WAGTAIL
} else if (src.includes("media.wnyc.org")) {
return cmsSources.PUBLISHER
} else if (src.includes("media.npr.org")) {
return cmsSources.NPR
} else {
return cmsSources.WAGTAIL
}
Expand Down

0 comments on commit 54b2a6a

Please sign in to comment.