Closed henrikwirth closed 3 years ago
It seems this could be a problem of pathPrefix not being passed down to the gatsby-plugin-catch-links
.
Is there a way to overwrite the plugin and use it in our main project instead?
@henrikwirth you should be able to add gatsby-plugin-catch-links
to your gatsby-config.js
and it'll use that instead.
I don't see an option for that in that plugin though, so this plugin may need to check for a path prefix and add it to the inline relative links
Yep, looks like this plugin (gatsby-source-wordpress-experimental) needs to handle this https://github.com/gatsbyjs/Gatsby/blob/master/packages/gatsby-plugin-catch-links/src/catch-links.js#L167
So after playing around a little, I figured, that the problem mainly arises from the fact, that the links inside content are written as follows:
<a href="/some-internal-link/">Some Link</a>
The problem is that usually, if you would use GatsbyLink on a link like this, it would prefix the link automatically. This doesn't happen for the links inside Wysiwyg though, since the node process function only picks up links, that have the actual WordPress backend domain in front. Like:
<a href="https://wp-backend.com/some-internal-link/">Some Link</a>
I think it would be great to have that as an option. like add path prefix to relative urls inside content
. And I believe this should even be the default behavior.
I'm cleaning up this repo a bit and moving this issue to our internal backlog. If anyone finds this issue and needs this sooner please add a feature request to https://portal.gatsbyjs.com/gatsby-cloud
Inside content links are missing the pathPrefix in version 1.7.9.
Since I don't see anything related to it in the changelog, I suspect this is still a problem in newer versions.
@TylerBarnes Is there any way we could spin up a 1.7.10 or 1.8. only with that fix? I'm stuck on these version since I can't upgrade WPGatsby or WPGraphQL any further for now.