From 1a61ee71c5440c3c289ba3e4f756509638aeba51 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Fri, 26 Feb 2021 18:19:20 -0800 Subject: [PATCH] replacing hompage links can break images.. only replace if they don't include wp-content, etc --- .../src/steps/source-nodes/create-nodes/process-node.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js b/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js index f2cb23da72615..8ac48aa5fc9a1 100644 --- a/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js +++ b/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js @@ -827,7 +827,11 @@ const replaceNodeHtmlLinks = ({ wpUrl, nodeString, node }) => { const normalizedPath = path.replace(/\\/g, ``) // replace normalized match with relative path - const thisMatchRegex = new RegExp(normalizedMatch, `g`) + const thisMatchRegex = new RegExp( + normalizedMatch + `(?!/?wp-content|/?wp-admin|/?wp-includes)`, + `g` + ) + nodeString = nodeString.replace(thisMatchRegex, normalizedPath) } catch (e) { console.error(e)