Skip to content

Next link points to itself if first TOC item is the homepageΒ #5165

@LordSimal

Description

@LordSimal

Describe the bug

This bug was found while developing https://book.cakephp.org/chronos/3/

We had added the homepage to the sidebar TOC since we don't have a separate homepage MD like many other vitepress sites have.

But this caused a problem with the "Next" Button present the bottom of the docs.

Image

We remove the TOC entry as can be seen in cakephp/chronos@3bed5bb

and now its working fine again.

Reproduction

  • Create a Vitepress instance without a index.md
  • Create 2 markdown files and link them in the toc
  • Go to the "homepage" and try to move to the next page via the button at the bottom

Expected behavior

It should skip to the next available TOC item which is not the current page

System Info

System:
    OS: macOS 26.3.1
    CPU: (14) arm64 Apple M4 Pro
    Memory: 5.13 GB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.11.1 - /Users/kevin/.nvm/versions/node/v24.11.1/bin/node
    npm: 11.6.2 - /Users/kevin/.nvm/versions/node/v24.11.1/bin/npm
    pnpm: 10.26.1 - /Users/kevin/.nvm/versions/node/v24.11.1/bin/pnpm
  Browsers:
    Chrome: 146.0.7680.165
    Firefox: 146.0.1
    Safari: 26.3.1

Additional context

We are using v2.0.0-alpha.16 (you should add this to the github issue template πŸ˜‰ )

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    themeRelated to the theme

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions