Repository navigation
Can not get right routes with multi sections #2370
Description
Activity
Hi @L-Super , I can not find the
A-Programmers-Guide-to-Englishin the sidebar. there is what I did:- Folk the repo you provide.
- Run
docsify serve docson the root. - Go to the on live site and click the sidebar jump into different sections.
- Check each of the sidebar generated routes on the sidebar.
- Check the contents and url.
I didn't see any path similar as you mentioned:
http://localhost:3000/#/A-Programmers-Guide-to-English/essence/make-a-program/READMEBut I found the
/CPP-Concurrency-in-Action-2nd-Edition/content/seems has issue as well when I clicked its sidebar different titles more times.

So, I try to work on it directly to make it works, it is similar to rewrite the path ( include File path).
Hope it helps as a sample.
What I did:
- Change the path in
/CPP-Concurrency-in-Action-2nd-Edition/guide.md--- removing all the rest of/beforecontent.(BTW, so does theEnglish-level-up-tipssection)
- Create
aliasto replace routes (rewrite to the right md doc path).
window.$docsify = { alias:{ '\/CPP-Concurrency-in-Action-2nd-Edition.*(?:.*\/content\/(.*))': '/CPP-Concurrency-in-Action-2nd-Edition/content/$1' } }
Besides, correct the hash url in browser as well.
window.$docsify = { plugins: [ function(hook, vm){ hook.beforeEach(content=>{ const cpp = "\/CPP-Concurrency-in-Action-2nd-Edition.*(?:.*\/content\/(.*))" const regex = new RegExp(`^${cpp}$`) let path = window.location.hash && window.location.hash.substring(1) if(regex.test(path)){ path = '/CPP-Concurrency-in-Action-2nd-Edition/content/'+path.match(regex)[1] history.replaceState(null, null, `#${path}`); } }) } ] }
TBH, It works but so cumbersome...
I suppose that restructure your project should be more practicable.Hi @L-Super , I can not find the
A-Programmers-Guide-to-Englishin the sidebar. there is what I did:- Folk the repo you provide.
- Run
docsify serve docson the root. - Go to the on live site and click the sidebar jump into different sections.
- Check each of the sidebar generated routes on the sidebar.
- Check the contents and url.
I didn't see any path similar as you mentioned:
http://localhost:3000/#/A-Programmers-Guide-to-English/essence/make-a-program/READMEBut I found the
/CPP-Concurrency-in-Action-2nd-Edition/content/seems has issue as well when I clicked its sidebar different titles more times.

So, I try to work on it directly to make it works, it is similar to rewrite the path ( include File path).
Hope it helps as a sample.
What I did:
- Change the path in
/CPP-Concurrency-in-Action-2nd-Edition/guide.md--- removing all the rest of/beforecontent.(BTW, so does theEnglish-level-up-tipssection)
- Create
aliasto replace routes (rewrite to the right md doc path).
window.$docsify = { alias:{ '\/CPP-Concurrency-in-Action-2nd-Edition.*(?:.*\/content\/(.*))': '/CPP-Concurrency-in-Action-2nd-Edition/content/$1' } }
Besides, correct the hash url in browser as well.
window.$docsify = { plugins: [ function(hook, vm){ hook.beforeEach(content=>{ const cpp = "\/CPP-Concurrency-in-Action-2nd-Edition.*(?:.*\/content\/(.*))" const regex = new RegExp(`^${cpp}$`) let path = window.location.hash && window.location.hash.substring(1) if(regex.test(path)){ path = '/CPP-Concurrency-in-Action-2nd-Edition/content/'+path.match(regex)[1] history.replaceState(null, null, `#${path}`); } }) } ] }
TBH, It works but so cumbersome...
I suppose that restructure your project should be more practicable.A-Programmers-Guide-to-Englishis in the navbar. Both the navbar and the sidebar have the same issue. I believe that the problem is that docsify does not support multi-level directories. It would be great if it could directly support multi-level directories without requiring users to modify the file structure.Finally, thank you very much for your patient answer.Bug acknowledged. Tracking with #1891.
I placed this repo under the docs folder and renamed SUMMARY.md to guide.md, while my directory structure for docs is as follows:

index.html:
root guide.md:
Directory structure:
When I switch between different sections from the left side, the URL shows an incorrect path.
Current behaviour:
Expected behaviour:
Originally posted by @L-Super in #1891 (comment)