Skip to content

404 error with a different http server for sidebar files #1713

Open
@CxRes

Description

@CxRes

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:

 "GET foo/docs/bar/_sidebar.md" Error (404): "Not found"

The pages however work fine with the global sidebar loaded.

Steps to reproduce

Configurations that I have tried:

  1. Original
    Files are in /foo/docs
    Homepage is /foo/docs/bar/README.md
    I have a static sidebar at /foo/docs/_sidebar.md
window.$docsify = {
      name: 'foo',
      alias: {
        '/':'/bar/',
      },
      basePath: '/foo/docs/',
      relativePath: false,
      loadSidebar: '_sidebar.md',
     ...
}

1a.

window.$docsify = {
      name: 'foo',
      alias: {
        '/':'/bar/',
      },
      basePath: '/foo/docs/',
      relativePath: false,
      loadSidebar: '/_sidebar.md', //explicit slash
     ...
}
window.$docsify = {
      name: 'foo',
      alias: {
        '/':'/bar/',
        '/.*/_sidebar.md': '/_sidebar.md', // alias as in docs
      },
      basePath: '/foo/docs/',
      relativePath: false,
      loadSidebar: '_sidebar.md',
     ...
}
window.$docsify = {
      name: 'foo',
      alias: {
        '/':'/bar/',
        '/foo/docs/.*/_sidebar.md': '/foo/docs/_sidebar.md', // full alias which is probably incorrect
      },
      basePath: '/foo/docs/',
      relativePath: false,
      loadSidebar: '_sidebar.md',
     ...
}

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugconfirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions