Skip to content

Docsify does not handle 404 errors gracefully #524

Closed
@jhildenbiddle

Description

@jhildenbiddle

Sections of the UI are dependent on successfully loading the specified content. AJAX requests should be decoupled when possible to prevent one failure from causing another.

  1. If a window URL contains hash that results in a 404 on initial page load, the “404 - Not found” message appears but the external sidebar content is not loaded, thus making it difficult to navigate to another page.

    Example: https://docsify.js.org/#/foo

    • For sites that do not load an external sidebar, consider redirecting to the site root if the notFoundPage option is unspecified.
    • For sites that do load an external sidebar, load the sidebar without marking an item as active. This will allow the user to navigate away from the 404 error to another page.
  2. If an :include results in a 404 on initial load, neither the sidebar nor the other page content loads. Users are left with a blank screen, no navigation, and no idea what went wrong. The sidebar should render, as should the content with the missing :include data (perhaps a "unable to load xxx" element can be inserted where the failed :include was located).

  3. After initial load, if a user navigates to a page with an :include that results in a 404 it appears as though nothing happens (although the console reveals that a 404 error has occurred). This scenario should be handled the same way as the above :include issue: load and display the content available, perhaps with placeholder content for the failed :include.

  4. There is no way to detect a 404. This can be useful for themes that offer full-screen overlay loaders or injecting 404 content from a file rather than using the notFoundPage option. A hook.error method or a data-status attribute added to the <body> would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions