feat: docs url on landing page navigates to the selected version#612
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the landing page navigation by making documentation links version-aware, ensuring users are directed to their preferred documentation version instead of always defaulting to the latest version.
Changes:
- Added logic to construct documentation URLs based on the user's preferred version
- Updated all three documentation links (user, admin, developer) to use dynamic paths
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…n links to user documentation when on landing page
| return `/docs/${section}/`; | ||
| } | ||
|
|
||
| return `${preferredVersion.path}/${section}/`; |
There was a problem hiding this comment.
Is the preferredVersion.path guaranteed to not have a trailing slash? 🙈 Do you have some utility function at hand you can use for robust path joining, like our urlJoin in web, so that it will get harder to break paths?
There was a problem hiding this comment.
Is the preferredVersion.path guaranteed to not have a trailing slash?
Yes, because it also relies on joining further parts to build consistent URLs , the (preferred)version object is auto-generated and relies on that format.
Do you have some utility function at hand
Unfortunately, there is no docusaurus public api for that. I could add something similar for that use case, but It feels a little overengineered
There was a problem hiding this comment.
mainly wanted to make sure that you're sure 😁 enforcing it would have been the icing on the cake. not a requirement from me
No description provided.