-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
website: Add trailing slash to /api
to prevent 404
#263
Conversation
I just merged you PR and, when I tested it locally, I got errors because the links now look like that: I probably should have looked more carefully at what your were proposing. In fact, what problem is that PR solving? Meanwhile, I'm going to revert it until we can figure out what's going on. |
The problem is that when you're using My proposal was to always keep the trailing slash and update the paths to match with it (so without |
I tried to re-build the website myself and I didn't had this issue. By the way, the link for the API Reference is wrong in the If you want me to illustrate what my PR fixes, I'll try to show you what is happening for me.
|
Well... I have been scratching my head over this for the past two hours. There are trailing slash issues in Docusaurus. Also, you can check out this table to understand how various hosting providers handle trailing slashes (webmidijs.org is hosted on GitHub). So far, the only way I could make everything work is by setting Docusaurus' trailingSlash directive to I tried setting the So, for now, the link to the API page is By the way, thanks for bringing this issue to light. I really wish there would be a better solution... |
Well, we could maybe do a script that fixes the build before pushing it to GitHub. As you can see, in the So maybe, we could remove the Or we could do the contrary by keeping every trailing slash. According to this guide https://github.com/slorber/trailing-slash-guide, when hitting a folder from |
We could do that but, honestly, I'd like to keep things simple. It's already complicated enough as it is.
I tried keeping all trailing slashes ( There's probably a clean way to fix all this but I just don't have the bandwidth right now. For now, unless users manually play with the URLs, the documentation is working fine. Having said that, if you find a clean solution, I will happily merge it. Thanks again for your help on this matter. |
I contacted the Docusaurus technical team and was finally able to find a better solution. Inside a specific plugin, you can link to the actual markdown files instead of using urls. When you do so, Docusaurus takes care of properly updating links. This is what I did for the For links across plugins, the solution is to use root-relative links. So, all links in the With both these changes, I think we now have something that's clean and working properly. |
When navigating on the navbar to the 3.x API, you are redirected to
/api
and every links there are something likeapi/classes/...
.But when you're navigating using the sidebar in API, you're redirected to
/api/
which breaks all the links in the page because of the paths.Here, my solution is to add the trailing slash to
/api
in the navbar and to remove all theapi/
in the links from the API index page.Hope it helps !