Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to apply navbar in versioning ? #14

Open
karunpatp-opsta opened this issue Dec 25, 2024 · 0 comments
Open

How to apply navbar in versioning ? #14

karunpatp-opsta opened this issue Dec 25, 2024 · 0 comments

Comments

@karunpatp-opsta
Copy link

karunpatp-opsta commented Dec 25, 2024

Hello,

I have a trouble with navbar applied in each version

I tried adding navbars/versioned/{my-version}.json but it redirects in root version only when I switch to another version that not from root

//*navbars/versioned/v4.0.0
[
  {
    "text": "Introduction",
    "link": "/v4.0.0/intro/...",
    "activeMatch": "^/intro/"
  }
]
//*navbars/versioned/v5.0.0 (root)
[
  {
    "text": "Introduction",
    "link": "/intro/...",
    "activeMatch": "^/intro/"
  }
]

Config:

import { DefaultTheme } from "vitepress"
import defineVersionedConfig from "vitepress-versioning-plugin"

// https://vitepress.dev/re ference/site-config
export default defineVersionedConfig(
  {
    versioning: {
      latestVersion: "v5.0.0",
      sidebars: {
        sidebarContentProcessor(sidebar) {
          return sidebar
        },
      },
    },
    themeConfig: {
      versionSwitcher: {
        text: "Switch version",
      },
      nav: [
        {
          text: "Introduction",
          link: "/intro/",
          activeMatch: "^/intro/",
        }
      ],
      sidebar: {
        "/intro/": [
          {
            text: "Introduction",
            items: [
              ....
            ],
          },
        ],
        "/v4.0.0/intro/": [
          {
            text: "Introduction",
            items: [
             ....
            ],
          },
        ],
      },
    },
  },
  __dirname
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant