question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

404 error with a different http server for sidebar files

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
GregEisenbergcommented, Feb 17, 2022

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!

2reactions
sy-recordscommented, Feb 17, 2022

Try setting alias

        alias: {
            '/.*/_sidebar.md': '/_sidebar.md'
        },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error 404: 4 Ways to Fix It - Hostinger
Error 404 is a response code, meaning the server could not locate the requested content. Check this article to learn 4 steps to...
Read more >
How to Find and Fix 404 Errors - Neil Patel
A 404 error (also known as an HTTP 404 or 404 code) is a very specific type of client error. It means the...
Read more >
Getting 404 error while accessing component of another ...
I have created an application with multiple components and routes, When I try to access the component directly from the server with folder...
Read more >
WebStorm generates a 404 error on an empty HTML5 file
Edit: Sorry, cannot post the image due to the size being too large (the image is 3MB vs the allowed 2MB). I think...
Read more >
How to Fix WordPress Error 404 Not Found - DreamHost
Problems with the permalink structure of your site. Permalink problems can be caused by a missing, broken, or corrupted .htaccess file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found