Open CxRes opened 2 years ago
where is your index.html? in /foo/docs/ or /foo/ if your index.html in /foo/ Configurations blow can work
window.$docsify = {
name: "foo",
alias: {
"/bar/": "/",
},
basePath: "/docs/",
loadSidebar: "_sidebar.md",
homepage: "README.md",
...
}
where is your index.html? in /foo/docs/ or /foo/ if your index.html in /foo/ Configurations blow can work
Sorry it was not clear but as I said above, files are in /oo/docs/
including index.html
. The configuration works fine in that my page loads, except I get 404 error for missing sidebar for each and every route like for /foo/docs/bar/_sidebar.md
or /foo/docs/baz/_sidebar.md
. Docsify simply should not even be looking for these routes with loadSidebar
specified as a file and exclusively look at /foo/docs/_sidebar.md
for all routes. (that's why I classify this a bug)!
you can read https://docsify.js.org/#/more-pages?id=nested-sidebars. you configure
alias: {
"/": "/bar/",
},
when you look at /foo/docs/_sidebar.md, you will redirect /foo/docs/bar/_sidrbar.md, so you get 404 error. So delete it and modify homePage : "/bar/README.md". Configurations below can work
window.$docsify = {
name: "foo",
loadSidebar: "_sidebar.md",
homepage: "/bar/README.md",
If I understand correctly, you've specified a specific sidebar, so it should not try to find side bar files based on your current path. I believe this should be improved.
I believe I am running into this issue too. Using c4Builder which use docsify it is generating a docsify site with sidebar. The top level pages all work perfectly. But any page in a subdirectory gets 404 for the _sidebar.md
file and there is 1 request made per level of nesting. These requests are all initiated from the docsify/lib/docsify.min.js
code.
Not sure if there is some setting which c4Builder needs to set when call docsify or if I am just hitting this issue.
Try setting alias
alias: {
'/.*/_sidebar.md': '/_sidebar.md'
},
Thanks @sy-records for your FAST reply. I was able to set
"alias": {
'/.*/_sidebar.md': '/_sidebar.md'
},
in the JSON object called window.$docsify
in index.html and that does seem to solve the issue. However since I am using the c4Builder
which calls docsify
and generates the index.html
I will have to figure out how to get this included by default.
Was I correct in adding to the window.$docsify
object in index.html? Was there some other place to add it?
Thanks again!
@sy-records Thanks!
@sy-records Could you please take a few minutes to see why this sidebar is not loading cased by a 404 error of _sidebar.md
?
I've tried both GitHub Actions
and Deploy from a branch
.
@QPod0 No GitHub Actions is required, no Jekyll theme needs to be set, just open the page, select the corresponding branch and directory.
Thanks @sy-records ! It now works well.
Bug Report
I am using a different server than the one provided by docsify-cli (http-server) because of docsifyjs/docsify-cli#32. I find that the server keeps complaining about missing sidebar file for each route even though I have set a global sidebar file. Like so:
The pages however work fine with the global sidebar loaded.
Steps to reproduce
Configurations that I have tried:
/foo/docs
Homepage is/foo/docs/bar/README.md
I have a static sidebar at/foo/docs/_sidebar.md
1a.
2.
3.
In each of these cases, I get the 404 error.
What is current behaviour
There is an 404 error message for missing sidebar for each route, even when a global sidebar is defined.
What is the expected behaviour
There should be no error message! Docsify should not look for a local sidebar file.
Other relevant information
[ ] Bug does still occur when all/other plugins are disabled?
Your OS: Windows 10 x64
Node.js version: 14.17.5
npm/yarn version: 6.14.14
Browser version: Version 1.33.106 Chromium: 96.0.4664.110 (Official Build) (64-bit)
Docsify version: 4.12.1
Docsify plugins: None
Please create a reproducible sandbox
Cannot do so, as I need to change how the page is served. Help appreciated.