A lightweight, zero‑dependency widget that displays GitHub repository stats as a card.
English | 简体中文
-
Auto‑fetches stars, forks, description, and primary language from GitHub API.
-
Responsive grid layout.
-
No build step, no external dependencies.
- Include the script
<script src="github-card.js"></script>- Add a container with the repository name
<div data-github-repo="owner/repo"></div>- (Optional) Wrap multiple cards in a grid container for responsive grid layout.
<div class="github-cards-grid">
<div data-github-repo="link9596/Github-Card"></div>
<div data-github-repo="vuejs/vue"></div>
</div>- (Optional) Increase API rate limit with a GitHub token Place this before the script tag:
<script>
window.GithubCardToken = 'your_personal_access_token';
</script>
<script src="github-card.js"></script>We do not recommend exposing the Access Token. You can hide the Access Token via a proxy and then use your custom proxy API source:
<script>
window.GithubCardProxy = 'https://example.yourdomain.com/';
</script>
<script src="github-card.js"></script>Without a token: 60 requests per hour. With a token: 5,000 requests per hour.
Example
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My GitHub projects</title>
</head>
<body>
<div class="github-cards-grid">
<div data-github-repo="link9596/Github-Card"></div>
<div data-github-repo="vuejs/vue"></div>
</div>
<script src="github-card.js"></script>
</body>
</html>