Skip to content

Relative Links from content/index.md 404 when using basePath #4683

@pcorliss

Description

@pcorliss

Describe the bug

When the content/index.md file contains a relative link (./foo/bar.md) and basePath is set the link targets /foo/bar instead of /base-path/foo/bar. When clicking on the link the user receives a 404.

To Reproduce Steps to reproduce the behavior:

Repro repo: https://github.com/pcorliss/nextra-sidebar-repro

  1. git clone https://github.com/pcorliss/nextra-sidebar-repro.git
  2. cd nextra-sidebar-repro
  3. npm ci
  4. npm run dev
  5. Navigate to http://localhost:3000/sidebar-repro
  6. Clicking [relative link](./generated/aa/test-file-081.md) results in a 404
  7. Clicking [relative with basePath](./sidebar-repro/generated/aa/test-file-081.md) renders
  8. Clicking [absolute link](/generated/aa/test-file-081.md) renders

Expected behavior

Relative links from the content/index.md page should not 404.

Desktop (please complete the following information):

  • OS: MacOs & Windows
  • Browser: Chrome & Firefox
  • Version Chrome 137.0.7151.104, Firefox 139.0.4 (aarch64)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @pcorliss

        Issue actions

          Relative Links from content/index.md 404 when using basePath · Issue #4683 · shuding/nextra