如何向导航栏添加按钮?

发布于 2025-01-20 10:00:20 字数 276 浏览 3 评论 0原文

我刚刚开始使用 Docusaurus,我想在导航栏中添加一个“注册”按钮(是的,我知道它仅用于文档)。我尝试过swizzleing 组件,但没有成功。我认为这与此 react 代码 有关:

<Link
        className="button button--secondary button--lg"
        to="/docs/intro">
        Sign Up
</Link>

I've just started using Docusaurus and I want to add a Sign Up button to the navbar (yes, I know that it's for documentation only). I have tried swizzleing the componenets but I've had no luck. I think it has something to do with this react code:

<Link
        className="button button--secondary button--lg"
        to="/docs/intro">
        Sign Up
</Link>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柏拉图鍀咏恒 2025-01-27 10:00:20

Docusaurus 支持通过扩展配置文件中的默认主题来向导航栏添加按钮。

要添加简单的注册按钮,您可以在站点的根目录中创建一个 docusaurus.config.js 文件。

module.exports = {
  themeConfig: {
    navbar: {
      items: [
        {
          to: 'docs/intro',
          label: 'Signup',
          position: 'left',
          className: 'button button--secondary button--lg'
        },
      ],
    },
  },
};

Docusaurus supports adding buttons to the navbar by extending the default theme in a configuration file.

To add a simple signup button you can create a docusaurus.config.js file in the root directory of your site.

module.exports = {
  themeConfig: {
    navbar: {
      items: [
        {
          to: 'docs/intro',
          label: 'Signup',
          position: 'left',
          className: 'button button--secondary button--lg'
        },
      ],
    },
  },
};
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文