GitHub 信息
显示你的 GitHub 仓库信息
Install to your codebase
Easier customisation & control.
使用
🌐 Usage
import { GithubInfo } from 'fumadocs-ui/components/github-info';
export function MyComp() {
return (
<GithubInfo
owner="fuma-nama"
repo="fumadocs"
// your own GitHub access token (optional)
token={process.env.GITHUB_TOKEN}
/>
);
}建议使用 links 选项将其添加到你的文档布局中:
🌐 It's recommended to add it to your docs layout with links option:
import { DocsLayout, type DocsLayoutProps } from 'fumadocs-ui/layouts/notebook';
import { baseOptions } from '@/lib/layout.shared';
import { source } from '@/lib/source';
import { GithubInfo } from 'fumadocs-ui/components/github-info';
function docsOptions(): DocsLayoutProps {
return {
...baseOptions(),
tree: source.getPageTree(),
links: [
{
type: 'custom',
children: <GithubInfo owner="fuma-nama" repo="fumadocs" className="lg:-mx-2" />,
},
],
};
}
export default function Layout({ children }: { children: React.ReactNode }) {
return <DocsLayout {...docsOptions()}>{children}</DocsLayout>;
}Last updated on
