Repository navigation
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I'm using the latest version of Docusaurus.
- I have tried the
npm run clearoryarn clearcommand. - I have tried
rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
- I have read the console error message carefully (if applicable).
Description
Well, I'm using the 2.0.1 version.
If you open https://pulsar.apache.org/docs/standalone, although its source content is:
---
id: standalone
title: Set up a standalone Pulsar locally
sidebar_label: "Run Pulsar locally"
---
````mdx-code-block
import {Redirect} from '@docusaurus/router';
<Redirect to="getting-started-standalone" />
````
It's redirected to https://pulsar.apache.org/docs/standalone/getting-started-standalone instead of https://pulsar.apache.org/docs/getting-started-standalone.
Moreover, it works well when previewing locally.
Reproducible demo
No response
Steps to reproduce
As described above.
Expected behavior
Correctly redirected to https://pulsar.apache.org/docs/getting-started-standalone.
Actual behavior
Wrongly redirected to https://pulsar.apache.org/docs/standalone/getting-started-standalone.
Your environment
- Public source code: https://github.com/apache/pulsar-site/tree/main/site2/website-next
- Public site URL: https://pulsar.apache.org/docs/standalone
- Docusaurus version used: 2.0.1
- Environment name and version (e.g. Chrome 89, Node.js 16.4):
- Operating system and version (e.g. Ubuntu 20.04.2 LTS):
Self-service
- I'd be willing to fix this bug myself.
Activity
slorber commentedon Nov 10, 2022
This is due to your host doing a server-side redirect to
standalone/so the relative link is resolved client-side in a different wayYou may have configured
trailingSlashincorrectly for your specific host, leading to issues.Make sure to read the deployment docs more carefully and configure trailingSlash correctly.
Make sure all URLs are always served with/without a trailing slash consistently, and adjust your relative links accordingly
Note we have a client-side redirect plugin, but it's always preferable to use a server-side redirect for such case. If you use GitHub Pages (for which we recommend an explicit trailingSlash config), it's quite limited, and you'd rather use a better, more featured host such as Netlify or Vercel
tisonkun commentedon Nov 10, 2022
Thank you!