-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gatsby-transformer-remark] Add pathPrefix
to relative links
#3823
Merged
KyleAMathews
merged 4 commits into
gatsbyjs:master
from
bodia-uz:topics/remark-use-pathprefix
Feb 7, 2018
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
98ad1aa
[gatsby-transformer-remark] Add `pathPrefix` to relative links
bodia-uz a5afa53
[gatsby-transformer-remark] add minor comment to `withPathPrefix`
bodia-uz fd70a9a
[gatsby-transformer-remark] add `pathPrefix` to `cacheKey` functions
bodia-uz 665a475
[gatsby-transformer-remark] remove `node.url.startsWith(pathPrefix)` …
bodia-uz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[gatsby-transformer-remark] add
pathPrefix
to cacheKey
functions
- Loading branch information
commit fd70a9a1b776f483e9f3ea487415274d949477db
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about assuming any relative link in a markdown file should be appended with a
pathPrefix
? Otherwise, we can wrongfully skip adding the pathPrefix to the links starting with something similar to a pathPrefix value. For example, having apathPrefix = "/web"
and a relative link/website/details
we'll get a link with nopathPrefix
added.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Mb its better to skip
!node.url.startsWith(pathPrefix)
condition.@KyleAMathews what You think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gatsby-link
does not check if linkstartsWith(pathPrefix)
, so looks like this code also should not.https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-link/src/index.js#L20-L24
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bodia-uz yeah — don't see a reason to add that check. E.g. what if there was a path named
/my-site/
but your prefix was also/my-site/
. Then that path would mysteriously not be prefixed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Updated.