LogoStartup0 文档

GitHub 信息

显示您的 GitHub 仓库信息

使用方法

import { GithubInfo } from 'fumadocs-ui/components/github-info';
 
<GithubInfo
  owner="fuma-nama"
  repo="fumadocs"
  // 您自己的 GitHub 访问令牌(可选)
  token={process.env.GITHUB_TOKEN}
/>;

建议将其添加到您的文档布局中,使用 links 选项:

app/docs/layout.tsx
import { DocsLayout, type DocsLayoutProps } from 'fumadocs-ui/layouts/notebook';
import type { ReactNode } from 'react';
import { baseOptions } from '@/app/layout.config';
import { source } from '@/lib/source';
import { GithubInfo } from 'fumadocs-ui/components/github-info';
 
const docsOptions: DocsLayoutProps = {
  ...baseOptions,
  tree: source.pageTree,
  links: [
    {
      type: 'custom',
      children: (
        <GithubInfo owner="fuma-nama" repo="fumadocs" className="lg:-mx-2" />
      ),
    },
  ],
};
 
export default function Layout({ children }: { children: ReactNode }) {
  return <DocsLayout {...docsOptions}>{children}</DocsLayout>;
}

目录