docsify icon indicating copy to clipboard operation
docsify copied to clipboard

_sidebar.md gives 404

Open testsmith-io opened this issue 3 months ago • 4 comments

Description

Maybe it is not a bug..., but I try to use docsify to serve documentation from a github subfolder. But it keeps giving a 404 on _sidebar.md.

-> Locally it work with docsify cli.

The repo structure is at follows:

- repo
-- docs
---getting-started
---quick-start.md
---README.md --> empty
--.nojekyll
--_sidebar.md
--index.html
--README.md
-CNAME
-index.html --> the normal website with a link to /docs...

The content of the file:

_sidebar.md

* [Home](/)
* [Quick Start](getting-started/quick-start.md)

Config in index.html

 window.$docsify = {
      name: 'Perfornium',
      repo: 'https://github.com/testsmith-io/repo',
      routerMode: 'history',
      homepage: 'README.md',

      // Sidebar configuration
      loadSidebar: true,
      autoHeader: true,
      subMaxLevel: 3,

      // Navigation
      loadNavbar: false,

      // Search
      search: {
        maxAge: 86400000,
        paths: 'auto',
        placeholder: 'Search documentation...',
        noData: 'No results found.',
        depth: 3
      },

      // Plugins
      copyCode: {
        buttonText: 'Copy',
        errorText: 'Error',
        successText: 'Copied'
      },

      // Custom theme
      themeColor: '#00d4ff'
    }

Contents of README.md

# perfornium-docs

Hello world!

``hello world``

It keeps giving a 404 on _sidebar.md

XHRGET https://domain.dev/docs/_sidebar.md [HTTP/2 404 11ms]

XHRGET https://domain.dev/_sidebar.md [HTTP/2 404 9ms]

Expected behavior

Sidebar loads with its content... and no 404 is shown.

Actual behavior

It keeps giving a 404 on _sidebar.md

XHRGET https://domain.dev/docs/_sidebar.md [HTTP/2 404 11ms]

XHRGET https://domain.dev/_sidebar.md [HTTP/2 404 9ms]

Steps to reproduce

see above

Environment

I serve the website using GitHub Pages.

Additional Information

  • [x] Bug still occurs when all/other plugins are disabled?

testsmith-io avatar Sep 07 '25 09:09 testsmith-io

ok the sidebar is shown with the following config in index.html

 window.$docsify = {
      name: 'Perfornium',
      repo: 'https://github.com/testsmith-io/repo',
      routerMode: 'history',
      homepage: '../README.md',

      // Sidebar configuration
      loadSidebar: true,
      autoHeader: true,
      subMaxLevel: 3,

      // Navigation
      loadNavbar: false,

      // Search
      search: {
        maxAge: 86400000,
        paths: 'auto',
        placeholder: 'Search documentation...',
        noData: 'No results found.',
        depth: 3
      },

      // Plugins
      copyCode: {
        buttonText: 'Copy',
        errorText: 'Error',
        successText: 'Copied'
      },

      // Custom theme
      themeColor: '#00d4ff'
    }

I have put a .nojykell in the root of the repo..

_sidebar.md looks like:

* [Home](/)
* [Quick Start](docs/getting-started/quick-start.md)

But not, when navigating to the quick start, it gives:

XHRGET
https://domain.dev/docs/getting-started/_sidebar.md
404

what needs to change?

testsmith-io avatar Sep 07 '25 09:09 testsmith-io

You need to set the alias configuration items.

sy-records avatar Sep 07 '25 10:09 sy-records

How should it looks like?

an alias like:

 alias: {
      '/.*/_sidebar.md': '/_sidebar.md',
      '/.*/_navbar.md': '/_navbar.md',
  },

did not work.

testsmith-io avatar Sep 07 '25 11:09 testsmith-io

I remember that GitHub pages don't seem to support history mode. You can switch to hash mode and try again.

sy-records avatar Sep 07 '25 11:09 sy-records