-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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(v2): allow relative URLs in URISchema #3449
Conversation
Deploy preview for docusaurus-2 ready! Built without sensitive environment variables with commit bd93556 |
Tested locally by manually building |
My original issue has been worked around as per discussion here: #3453 (comment) I think this PR is still valid for adding relative links and making the |
Hi. Honestly, I'm not confident merging this PR right now so I'm going to close it. Note that the "to" attribute is currently validated much less strictly, as it accept any string, and looks like it could do the job for your usecase, so it can be a good workaround until I know better how to solve these problems and don't rush on a solution. Still interested to understand better your usecase so if you have a specific need that is not covered properly, a repro and links to a live site to understand better would be welcome. |
Ok, don't think it'll be bad to be a bit less strict (as we accept any "to" anyway) so I'll merge it for now, hope to not regret this later. |
Motivation
Currently, relative links are invalid when configuring navbar items.
We currently run our documentation at a sub-path of our top level domain,
https://example.org/docs
. For the logo, it is valid to add a relative link up to our homepage:This behaves well, linking up to the relative parent page and forcing a full page reload.
I would also like the following configuration to be valid, for navbar items:
This is currently not possible to achieve within
themeConfig.navbar.items
, as anitem
shref
value is more strictly validated with URISchema, disallowing relative URLs.Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
Validation unit tests were updated to demonstrate that relative URLs can be configured for
URIScheme
, which is used to validateThemeConfig
.The existing test case was updated to a legitimately invalid URL.
This change will be less strict than master's validation, as documented by Joi.
Related PRs
I do not believe this requires any documentation changes.