Contributors
Link Git authors to GitHub accounts and credit people who aren't in the history.
Contributors come from each page's commits, including Co-authored-by trailers. By default, each person appears with their Git name and initials. This page shows how to link them to GitHub accounts for avatars and profile links, and how to credit people who didn't commit. To see the result, try the demo.
Author mappings
Map Git identities to GitHub usernames:
const options = {
repository: { url: 'https://github.com/owner/repository' },
authorMappings: [
{ gitName: 'Alex', githubUsername: 'alex' },
{ gitEmail: 'alex@example.com', githubUsername: 'alex' },
],
};Each mapping needs a githubUsername and a gitName, a gitEmail, or both.
- Matching ignores letter case and surrounding spaces.
- If a mapping has both
gitNameandgitEmail, a commit must match both. - If several mappings match, one with an email wins over one with only a name.
- Several mappings can point to the same account, for example to cover an old and a new email.
| Field | Required | Description |
|---|---|---|
githubUsername | Yes | GitHub account for the avatar and profile link. |
gitName | One of the two | Git author name to match. |
gitEmail | One of the two | Git author email to match. |
displayName | No | Name to show. Defaults to githubUsername. |
avatar, url | No | A different avatar or profile URL. |
i18n | No | Names for other locales, such as { 'zh-CN': '亚历克斯' }. |
For each author, Page History tries your mappings first, then GitHub noreply emails such as 123+alex@users.noreply.github.com, then the GitHub API if you enable it. Anyone still unmatched keeps their Git name and initials. Account names are never guessed.
Hovering a contributor shows how many commits they made to the page; each person counts once per commit. Emails are used only for matching and never appear in the page.
Credit additional contributors
To credit someone who didn't commit, such as a reviewer or the original author of migrated content, list them in frontmatter. First extend your page schema, then:
---
authors: [alex]
---A name can be a GitHub username from your mappings, a display name, or a Git name. People listed here appear even on a page that has no commits yet.
To show contributors without the history list, set gitChangelog: { disableChangelog: true }. The other per-page settings are in Per-page controls.
Optional GitHub lookup
For authors with an ordinary email rather than a GitHub noreply address, Page History can ask the GitHub API which account made the commit. Add a token:
{
repository: { url: 'https://github.com/owner/repository' },
github: { token: process.env.GITHUB_TOKEN },
}Lookup runs during the build, only for commit authors that no mapping matched, and only for commits that already exist in the GitHub repository. Co-authors are never given the commit author's account. Make the token available to your docs build. Public repositories need no extra permissions. For a private repository, a fine-grained token needs Contents: read.
| Option | Default | Description |
|---|---|---|
token | None | Without a token, lookup is skipped with a warning. |
cacheDir | node_modules/.cache/fumadocs-page-history | Cache folder, relative to the Git root. Set to false to turn caching off. |
maxRequests | 100 | Maximum API requests per build worker. |
timeoutMs | 5000 | Timeout for each request, in milliseconds. |
Found accounts are cached for seven days and misses for five minutes. Network errors and rate limits aren't cached. The cache is kept per repository and stores hashed emails, never the token or plain emails.
If GitHub rejects the token, rate-limits the build, times out, or returns an error, lookup stops for the rest of that build worker. Authors fall back to their Git names, with a single warning, and the build continues. Each worker has its own request budget, so a parallel build with an empty cache can make a few duplicate requests. For offline builds, leave out github.