-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
relative paths of links in sidebar should be relative to the sidebar file #1684
Comments
Hello @ruanqizhen What you described seems to be what the doc says: https://docsify.js.org/#/configuration?id=relativepath Can you make a reproduction? |
The current implementation only consider a single base path for relative paths. |
Just use the case in the document:
Suppose there is a single sidebar file for all the md files listed here, with the current relative path mechanism, there is not way to make the links in sidebar point to the right files. |
Found a workaround: I'm using absolute path in sidebar file, and using relative paths in other files now. |
I see what you're saying: yeah, links in sidebar should be relative to the sidebar file. That would be most intuitive. When this is implemented, we need to think if it needs to be behind an option so as not to break existing apps. |
I am also very interested in this functionality. In my use case I have a top-level "portal" docsify site that brings in several other project docsify sites as subfolders. Each of the projects has their own _sidebar. But when used in the portal, the links in the project sidebars no longer work because it's using the main top-level folder instead of looking relative to the folder containing the sidebar. |
It's possible that using |
Nope, that doesn't work either. If the projects have subfolders, then once a page in the subfolder is loaded, the other pages in the sidebar no longer work as they use the new subfolder as the relative path. So still can't find a way to basically embed one docsify site within another. I agree with the OP that the links in the sidebar should be relative to the location of the _sidebar file. Using |
Yeah, it's a bit counterintuitive right now. For backwards compat, I believe we need a new option for this ( Perhaps named like The docs need more clarity here too. |
How about |
Is there any approximate ETA on this or plugin that could be tried to get the functionality in the meantime? This will make multi-lingual and multi version libraries very much easier to create, and remove the limitations where you're forced to have your content for translations in different repositories. Or to put it another way, I have my docs structured like this.
And I have different versions stored as branches in same repo. I want to access the paths using aliases. If the sidebar links were relative to the sidebar then this would work for versions, translations, whatever, because the context would be relative to the imported root. As it is this can't work unless every summary has the full language and version path specified absolutely. Yuck. |
@chenGit1763113879QQ Not as far as I know. The workaround I use (not in production) is described here: https://evilmartians.com/chronicles/easy-multi-language-multi-version-documentation-with-docsify-git-and-github-actions |
Bug acknowledged. Tracking with #1891. |
Bug Report
The relative path should always based on the file that quote it.
For example, the path (foo) in file bar.md should always point to the foo.md file that in the same folder of bar.md.
But the current mechanism of relative path is based on the current url. That means if the current url is in folder xxxx, the (foo) in file bar.md file will point to the foo.md in folder xxxx.
That means the relative will never work if you have a sidebar with multiple layer of documents.
I hope this could be fixed in the next docsify version.
Other relevant information
Bug does still occur when all/other plugins are disabled?
Your OS:
Node.js version:
npm/yarn version:
Browser version:
Docsify version:
Docsify plugins:
Please create a reproducible sandbox
Mention the docsify version in which this bug was not present (if any)
The text was updated successfully, but these errors were encountered: