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.
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
fix(blog): apply baseUrl to relative image in blog authors #10440
fix(blog): apply baseUrl to relative image in blog authors #10440
Changes from 3 commits
c9d04f7
4f0214f
df86b3b
f18f124
3a69dd0
bbc86e8
bc3b714
835afd4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
If the goal is a double application, there's probably a better solution.
Remember that:
/blog/
/static/blog/
/blog/blog/authorImage.png
is perfectly validI think I'd prefer to not have this extra condition
In the past (
useBaseUrl
hook) it has been annoying because some users will use baseUrl/docs/
or/blog/
and duplicate paths like/docs/docs/someImage.png
or/blog/blog/someImage.png
should be allowedI'd like to have a unit test ensuring that we actually allow
/baseUrl/baseUrl/img/ozaki.jpg
What we want is to not apply the baseUrl if the author is a global author (ie it has a
key
).My suggestion:
The unit tests should clearly cover this case
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.
I don't think that's a good idea. No one should be producing these URLs on purpose. See my opinion in #6294 too.
If a URL is
/image.png
, it should be come/baseURL/image.png
, but/baseURL/image.png
should stay that way.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.
@Josh-Cena it's important that urls are portable, and that we can later use React Router built-in basename which will not have this deduplication logic (although it won't apply to images but only links)
You'll see for yourself that existing sites have
/docs/docs
already, whether it makes sense to you or not: https://eclipse-muto.github.io/docs/docs/mutoI know you want devs to be explicit in this case and write links such as
/docs/docs/muto
, but this means this link is not "baseUrl" portable anymore.Another case: the same sites at Meta are deployed in different fashions for public/internal usage, with/without baseUrl.
I'd like to discourage the usage of links that include the baseUrl to maximize portability.