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

Global versionDropDownItem #1561

Closed
karl-cardenas-coding opened this issue Sep 17, 2023 · 4 comments · Fixed by #1627
Closed

Global versionDropDownItem #1561

karl-cardenas-coding opened this issue Sep 17, 2023 · 4 comments · Fixed by #1627
Labels
enhancement New feature or request

Comments

@karl-cardenas-coding
Copy link
Contributor

@nagesh161007 I might have found a nice lil challenge for you. Take a peek at the README's versioning first

The current docs site is a multi-site that uses two plugins to render the default docs and the API.
The default docs version drop-down only applies to the default plugin. The API plugin api is not included when a user selects a version.

To address this, we need to create global version selector. There is an example here of how someone achieved this.

To generate the version content for the api plugin, use the command:

npx docusaurus docs:version:id 4.0.x

This will generate the following content:

  • api_versions.json - versions file for the API.
  • api_versioned_docs/ - folder containing all versioned docs.
  • api_versionioned_sidebars/ - folder containing the API sidebar.
    This would also require the docusaurs_config.js file to get updated:
  plugins: ["docusaurus-plugin-sass", ["@docusaurus/plugin-content-docs", {
    id: "api",
    path: "docs/api-content/api-docs",
    routeBasePath: "api",
    docItemComponent: "@theme/ApiItem",
    sidebarPath: require.resolve("./apisidebar.js"),
    versions: {
      current: {
        label: "latest"
      },
      "4.0.x": {
        banner: "none",
        label: "v4.0.x"
      },
      "3.4.x": {
        banner: "none",
        label: "v3.4.x and prior"
      }
    }
  }],
@karl-cardenas-coding karl-cardenas-coding added the enhancement New feature or request label Sep 17, 2023
@karl-cardenas-coding
Copy link
Contributor Author

Related facebook/docusaurus#4389

@nagesh161007
Copy link
Contributor

Sure @karl-cardenas-coding. Will check this and let you know

@nagesh161007
Copy link
Contributor

Hi @karl-cardenas-coding , I have made some changes for this yesterday. Will test this and raise PR soon

@karl-cardenas-coding
Copy link
Contributor Author

karl-cardenas-coding commented Sep 20, 2023

Awesome, I'm excited to test it out 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants