为您介绍非官方

GitHub按钮

通过可热链接的GitHub星标、复刻、赞助和关注按钮展示您的GitHub仓库的成功。提供两种尺寸,带有最新计数。

@mdo制作。可在GitHub上获取。基于Apache 2许可。


目录


星标

<iframe src="https://ghbtns.com/github-btn.html?user=twbs&repo=bootstrap&type=star&count=true&size=large" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>

<iframe src="https://ghbtns.com/github-btn.html?user=twbs&repo=bootstrap&type=star&count=true" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>

关注

最初,GitHub的关注按钮既用于通知设置(现在的关注)也用于仓库书签(现在的星标)。2012年8月,在这些非官方按钮发布后,他们将功能分为两个按钮

因此,对于现在的非官方关注按钮,您必须在参数中添加v=2。如果不这样做,您将获得已弃用的按钮

<iframe src="https://ghbtns.com/github-btn.html?user=twbs&repo=bootstrap&type=watch&count=true&size=large&v=2" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>

<iframe src="https://ghbtns.com/github-btn.html?user=twbs&repo=bootstrap&type=watch&count=true&v=2" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>

复刻

<iframe src="https://ghbtns.com/github-btn.html?user=twbs&repo=bootstrap&type=fork&count=true&size=large" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>

<iframe src="https://ghbtns.com/github-btn.html?user=twbs&repo=bootstrap&type=fork&count=true" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>

关注用户

<iframe src="https://ghbtns.com/github-btn.html?user=mdo&type=follow&count=true&size=large" frameborder="0" scrolling="0" width="230" height="30" title="GitHub"></iframe>

<iframe src="https://ghbtns.com/github-btn.html?user=mdo&type=follow&count=true" frameborder="0" scrolling="0" width="170" height="20" title="GitHub"></iframe>
<iframe src="https://ghbtns.com/github-btn.html?user=mdo&type=sponsor&size=large" frameborder="0" scrolling="0" width="180" height="30" title="GitHub"></iframe>

<iframe src="https://ghbtns.com/github-btn.html?user=mdo&type=sponsor" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>

无文本变体

<iframe src="https://ghbtns.com/github-btn.html?user=twbs&repo=bootstrap&type=star&size=large&text=false" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>

可用选项

SSL支持

示例按钮使用https://网址显示。虽然它们托管在GitHub Pages上,但SSL选项是通过Cloudflare的免费通用SSL服务提供的。

必需参数

必须为以下每个URL参数声明一个值:

选项 描述
user 拥有仓库的GitHub用户名/要赞助的用户名
repo 要获取复刻和关注者数量的GitHub仓库
type 要显示的按钮类型:watchforksponsorfollow

可选参数

以下URL参数不是必需的。根据需要添加它们。

选项 描述
count 显示可选的关注者或复刻计数:默认为nonetrue
size 使用较大按钮的可选标志:默认为nonelarge
text 隐藏文本的可选标志:默认为nonefalse

已弃用

原始关注,即星标

在2012年8月按钮分离后,GitHub的API继续为旧的关注按钮返回星标计数。因此,原始的非官方关注按钮返回一个临时星标按钮。

这个已弃用的按钮仍然存在,以避免破坏当前使用这些嵌入的每个网站。

<iframe src="https://ghbtns.com/github-btn.html?user=twbs&repo=bootstrap&type=watch&count=true&size=large" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>

<iframe src="https://ghbtns.com/github-btn.html?user=twbs&repo=bootstrap&type=watch&count=true" frameborder="0" scrolling="0" width="170" height="20" title="GitHub"></iframe>

局限性

对于这些第一版本,功能有限,做了一些让步:

iframe {
  overflow: hidden;
  border: 0;
}

通过开源计划进行更多改进和功能增强 — 任何帮助都将不胜感激!


开源

非官方GitHub按钮可在GitHub上下载、复刻或贡献。

在GitHub上查看


❤️