Validation of footer `href` values does not allow URI references (e.g. `/foo/bar`)
See original GitHub issueš Bug Report
Upgrading from 2.0.0-alpha.55 to 2.0.0-alpha.61 of all my docusaurus packages has resulted in a validation failure in a working docusaurus.config.js
file. In particular, In our project, I am deploying to Netlify, and using a netlify.toml
file to add a redirect /community/discord/join
URL that will redirect to the current Discord invite link.
In my footer, Iāve been using an item like:
{
label: "Discord",
href: "/community/discord/invite",
},
So that clicking that link in the footer will redirect the browser to that URL on the current host/origin server, which then redirects to the actual Discord link.
After updating all my NPM packages, I get an error when starting Docusaurus:
⯠npm start
> docs@0.0.0 start /home/peter/git/zmk/docs
> docusaurus start
Starting the development server...
A validation error occured.
The validation system was added recently to Docusaurus as an attempt to avoid user configuration errors.
We may have made some mistakes.
If you think your configuration is valid and should keep working, please open a bug report.
ValidationError: "footer.links[1].items[0].href" must be a valid uri
I canāt use to
instead of href
, because that will only redirect with the JS router, not cause a browser navigation, so that just 404s in JS land.
Workaround
I can hardcode the full production deployment URL for this one footer link. Itās not a huge problem. But doing so definitely seems āwrongā, and I would expect to be able to use a URI-reference for this field, not just a URI.
Have you read the Contributing Guidelines on issues?
Yup!
To Reproduce
(Write your steps here:)
- Bootstrap a new V2 docusaurus site with latest packages.
- Add a footer link item that uses a relative URI (no scheme or authority section), e.g.
/foo/bar
- Run
npm start
Expected behavior
A footer link will be added that performs a browser navigation to the given relative URI when clicked.
Actual Behavior
I canāt run/build docusaurus.
Your Environment
- Docusaurus version used: 2.0.0-alpha.61
Reproducible Demo
- Check out repo at
zmkfirmware/zmk
- Change into the
docs
directory. - Run
npm ci
- Run
npm start
and confirm it loads and footer link with labeled āDiscordā and confirm it works. - Run
npm update
to pull in latest Docusaurus NPM packages. - Run
npm start
- Confirm it fails to start.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
@slorber Thanks for the quick follow up. The only downside to using
DEPLOY_URL
is it doesnāt update after a particular deploy is promoted to the active deploy for the site, so your production site ends up w/ the long annoying deploy URL instead of the āniceā URL.I can use
process.env.URL
for now, but that doesnāt technically work, should I deploy a preview with a different redirect in thenetlify.toml
.Agreed this is a niche issue, but still something that seems worth thinking about supporting somehow in Docusaurus.
Thanks again for the great project.
@tommilligan Sure seems like that would address the issue I had to work around, yes.