Last active
February 24, 2020 14:51
-
-
Save astider/114cb23356ccda7d3e8795ccb82f2142 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// index | |
const posts = data.allGhostPost.edges | |
const host = location.origin // `bkkjs-example.web.app` | |
const match = new RegExp(`http://localhost:2368/content/images`, `g`) | |
const modPosts = posts.map(({ node }) => { | |
const modFeatureImg = node.feature_image ? node.feature_image.replace(match, `${host}/images`) : node.feature_image | |
const modAuthorImg = node.primary_author.profile_image ? node.primary_author.profile_image.replace(match, `${host}/images`) : node.primary_author.profile_image | |
// const modHTML = node.html.replace(match, `${host}/images`) | |
return { | |
node: { | |
...node, | |
feature_image: modFeatureImg, | |
primary_author: { | |
...node.primary_author, | |
profile_image: modAuthorImg, | |
}, | |
}, | |
} | |
}) | |
// post | |
const post = data.ghostPost | |
const host = location.origin // `bkkjs-example.web.app` | |
const match = new RegExp(`http://localhost:2368/content/images`, `g`) | |
const featureImg = post.feature_image ? post.feature_image.replace(match, `${host}/images`) : post.feature_image | |
const html = post.html.replace(match, `${host}/images`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment