This repository has been archived by the owner on Apr 20, 2021. It is now read-only.
fix: relative urls inside html content to include prefix #328
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #310
So when using pathPrefix, relativeUrls inside html don't get prefixed. This doesn't make much sense, since I might want to create content in WordPress with relative URLs that don't use the prefix yet, so later I can change the prefix to whatever I want.
Where this comes in handy and was really necessary, is a multisite setup with multiple translations.
What this fix does: When pathPrefix is used and the
pluginOption.prefixRelativeUrls
is active, the nodeStrings will be searched for elements, that start withhref=
and include a url that starts with/
.Excluded by the regex are urls that start with:
pathPrefix|/wp-content|/wp-admin|/wp-includes|//
So we don't want prefix already prefixed URLs or URLs that start with a double
//
.The other branch that was branched from v1.7.9 can be found here since I need a v1.7.10: https://github.com/henrikwirth/gatsby-source-wordpress-experimental/tree/fix-relative-urls-in-html