question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v2] how can i create a docsVersionDropdown

See original GitHub issue

image

This is my docusaurus.config.js:

const path = require('path');
const versions = require('./versions.json');

const allDocHomesPaths = [
  '/docs/',
  '/docs/next',
  ...versions.map((version) => `/docs/${version}/`),
];

module.exports = {
  title: 'anyRTC 实时音视频云Web SDK',
  tagline: 'ArRTC for Web SDK',
  url: 'http://docs.anyrtc.io',
  baseUrl: '/v4/rtc-web/',
  favicon: 'img/favicon.ico',
  organizationName: 'anyRTC', // Usually your GitHub org/user name.
  projectName: 'rtc-web', // Usually your repo name.
  themeConfig: {
    navbar: {
      hideOnScroll: true,
      title: 'anyRTC',
      logo: {
        alt: 'anyRTC Logo',
        src: 'img/favicon.ico',
        srcDark: 'img/docusaurus_keytar.svg',
      },
      items: [
        // {
        //   label: versions[0],
        //   position: 'left', // or 'right'
        //   items: function (path) {
        //     // redirect to /docs from /docs/introduction,
        //     // as introduction has been made the home doc

        //     let itemsPath = [];
        //     versions.map((version) => {
        //       itemsPath.push({
        //         label: version,
        //         to: 'docs/' + version,
        //       })
        //     });

        //     return itemsPath;
        //   }(),
        // },
        {
          type: 'docsVersionDropdown',
          position: 'left',
          nextVersionLabel: '2.0.0-next',
        },
        {
          to: 'docs/',
          activeBasePath: 'docs',
          label: 'Docs',
          position: 'right',
        },
        {
          to: 'docs/api/overview',
          activeBasePath: 'api',
          label: 'API',
          position: 'right',
        },
        // {to: 'blog', label: 'Blog', position: 'right'},
        {
          href: 'https://github.com/facebook/docusaurus',
          label: 'GitHub',
          position: 'right',
        },
        // {
        //   to: '/versions',
        //   label: 'All versions',
        //   position: 'right',
        // },
      ]
    },
    algolia: {
      apiKey: '5789ff188e53e9c3a53bf5a461bfeba4',
      indexName: 'anyrtc',
      appId: '3PL7UR0LOP', // Optional, if you run the DocSearch crawler on your own
      algoliaOptions: {
        // searchParameters: {
        //   facetFilters: [`version:${versions[0]}`],
        // },
      }, // Optional, if provided by Algolia
    },
    footer: {
      style: 'dark',
      links: [
        {
          title: '文档',
          items: [
            {
              label: '产品概述',
              to: 'docs/',
            },
            {
              label: '快速开始',
              to: 'docs/setup',
            },
            {
              label: 'API',
              to: 'docs/api/overview',
            },
          ],
        },
        {
          title: 'RTC其他平台',
          items: [
            {
              label: 'RTC Web SDK',
              href: 'https://docs.anyrtc.io/v4/rtc-web',
            },
            {
              label: 'RTC Android SDK',
              href: 'https://docs.anyrtc.io/v4/rtc-android',
            },
            {
              label: 'RTC iOS&Mac SDK',
              href: 'https://docs.anyrtc.io/v4/rtc-android',
            },
            {
              label: 'RTC window SDK',
              href: 'https://docs.anyrtc.io/v4/rtc-window',
            },
          ],
        },
        {
          title: 'RTM其他平台',
          items: [
            {
              label: 'RTM Web SDK',
              href: 'https://docs.anyrtc.io/v4/rtm-web',
            },
            {
              label: 'RTM Android SDK',
              href: 'https://docs.anyrtc.io/v4/rtm-android',
            },
            {
              label: 'RTM iOS&Mac SDK',
              href: 'https://docs.anyrtc.io/v4/rtm-android',
            },
            {
              label: 'RTM window SDK',
              href: 'https://docs.anyrtc.io/v4/rtm-window',
            },
          ],
        },
        {
          title: '更多',
          items: [
            {
              label: 'GitHub',
              href: 'https://github.com/facebook/docusaurus',
            },
            {
              label: 'anyRTC',
              href: 'https://www.anyrtc.io',
            }
          ],
        },
      ],
      logo: {
        alt: 'anyRTC Logo',
        src: 'img/anyrtc_logo.png',
        href: 'https://www.anyrtc.io',
      },
      copyright: `Copyright © ${new Date().getFullYear()} anyrtc.`,
    },
  },
  plugins: [
    [
      '@docusaurus/plugin-client-redirects',
      {
        fromExtensions: ['html'],
        createRedirects: function (path) {
          // redirect to /docs from /docs/introduction,
          // as introduction has been made the home doc
          if (allDocHomesPaths.includes(path)) {
            return [`${path}/introduction`];
          }
        },
      },
    ]
  ],
  presets: [
    [
      '@docusaurus/preset-classic',
      {
        docs: {
          // It is recommended to set document id as docs home page (`docs/` path).
          homePageId: 'overview',
          sidebarPath: require.resolve('./sidebars.js'),
          // Please change this to your repo.
          // editUrl:
          //   'https://github.com/facebook/docusaurus/edit/master/website/',
        },
        // blog: {
        //   showReadingTime: true,
        //   // Please change this to your repo.
        //   editUrl:
        //     'https://github.com/facebook/docusaurus/edit/master/website/blog/',
        // },
        theme: {
          customCss: require.resolve('./src/css/custom.css'),
        },
      },
    ],
  ],
};

Has anyone come to help?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17

github_iconTop GitHub Comments

1reaction
DyncMarkcommented, Jul 28, 2020

I’m sorry but you can see for yourself that the version exist: https://www.npmjs.com/package/@docusaurus/preset-classic/v/2.0.0-alpha.59

It is likely that you use some kind of NPM chinese proxy that is not updated with latest versions, this is not related to Docusaurus at all.

I can’t spend all my day helping you on this, I’ve already done everything I could, by pushing a working version to your repo. Please reach to other users on Discord to get help.

sure,I really appreciate your help :), I’ll check the problem by my self. Keep safety.

0reactions
chudongvipcommented, Aug 17, 2020

sorry but I can’t dedicate too much time helping you. Please try to get help on Discord first.

Your image problem might be related to using baseUrl, and this baseUrl is maybe not added in the image path (we made a PR recently so that you don’t need to use useBaseUrl hook, but not released yet, so in the meantime you may need that hook, read the doc to know more)

Thanks for your reply. Because my English is not very good, So I can not find a good solution, but I will always pay attention to you and the official documents. : )

Thanks again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Versioning - Docusaurus
First, make sure the current docs version (the ./docs directory) is ready to be frozen. Enter a new version number. npm; Yarn. npm...
Read more >
Add a Version Dropdown in Tutorial needs more explanation
The section Add a Version Dropdown in the Tutorial needs more explanation. It needs to be stressed that the changes to make to...
Read more >
Manage Docs Versions | jsPlumb Documentation
Docusaurus can manage multiple versions of your docs. ... The docs folder is copied into versioned_docs/version-1.0 and versions.json is created.
Read more >
Create an Application | BuildPiper Docs
Docs Version Dropdown. Here are the steps for creating an application. 1. Give a unique name to your application. 2. Enter the application...
Read more >
docusaurus-plugin-typedoc-api - npm
Our API is unable to use the docsVersionDropdown navigation type, as it's hardcoded in Docusaurus core. However, you can create a custom version ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found