Options
Set options in mkdocs.yml. All options with their defaults:
plugins:
- git-authors:
show_contribution: false
show_line_count: false
show_email_address: true
href: "mailto:{email}"
authors_file: ""
add_co_authors: false
add_page_meta: true
count_empty_lines: true
sort_authors_by: name
authorship_threshold_percent: 0
ignore_authors: []
ignore_commits: ""
copy_detection: 0
exclude: []
fallback_to_empty: false
enabled: true
enabled_on_serve: true
enable_parallel_processing: true
strict: true
Output
show_contribution
Default false. Show each author's share of the lines as a percentage:
Pages with one author show no percentage. mkdocs-material ignores this option unless you override its template.
show_line_count
Default false. Show each author's number of lines in the list of site authors (git_site_authors, see Usage).
show_email_address
Default true. Show author names as links, by default to their email address. Set to false for plain names.
href
Default mailto:{email}. The link target when show_email_address is true. You can use {email} and {name}, for example to link to a chat tool:
href: "https://teams.microsoft.com/l/chat/0/0?users={email}"
mkdocs-material ignores this option unless you override its template.
authors_file
Default "" (not set). A YAML file, relative to the directory of mkdocs.yml, that sets how authors are shown. It maps git email addresses (case is ignored) to a name, url and avatar, each optional:
jane@example.com:
name: Jane Doe
url: https://github.com/jane
avatar: https://github.com/jane.png
namereplaces the git name everywhere, including the sort order and{name}inhref.urlis the author's link, instead ofhref. It is used even whenshow_email_addressisfalse.avataris not shown by default. Templates can use it asauthor.avatar, see Usage.
The build fails if the file does not exist, is not valid YAML, or has a duplicate or unknown key, or a value that is not a string, so typos do not go unnoticed. Authors not in the file are shown as usual.
The file only changes how an author is shown, not who is credited. Use .mailmap to combine email addresses; it is applied first, so use the email address that .mailmap maps to.
sort_authors_by
Default name. Set to contribution to sort authors by their share of the lines, largest first. Authors are always sorted by contribution when show_contribution or show_line_count is true.
add_page_meta
Default true. Add the page authors to page.meta as git_authors and git_authors_names (see Page metadata). mkdocs-macros-plugin makes page.meta keys available as variables, so set this to false if these names clash with your own variables.
Counting
add_co_authors
Default false. Also credit the co-authors of a commit (Co-authored-by: lines in the commit message).
count_empty_lines
Default true. Count empty lines towards an author's contribution. Lines with only whitespace count as empty.
authorship_threshold_percent
Default 0, a value from 0 to 100. Leave out authors with a smaller share than this percentage, for example authors of small spelling fixes. It applies to page authors (share of the page) and site authors (share of the site). Pages with one author always show that author.
ignore_authors
Default []. Email addresses of authors whose lines are not counted:
ignore_authors:
- bot@example.com
ignore_commits
Default "". A file, relative to the directory of mkdocs.yml, with commit hashes (one per line) to ignore. The build fails if the file does not exist. This uses git blame --ignore-revs-file: git tries to attribute lines changed in these commits to an earlier commit. You can reuse a .git-blame-ignore-revs file:
ignore_commits: .git-blame-ignore-revs
copy_detection
Default 0, one of 0, 1, 2 or 3. git blame already follows a page through renames, but lines copied from another file are attributed to whoever made the copy, for example when you split a page in two. This option passes -C to git blame this many times (see the git docs), so that copied lines keep their original authors:
1: also detect lines moved within the page, and lines copied from files changed in the same commit. This covers splitting a page in a single commit.2: also detect lines copied from any file that existed in the commit that created the page. This covers copying a page without changing the original.3: also detect lines copied from files in any commit. This is the slowest option and can noticeably slow down large sites (seeenable_parallel_processing).
To combine authors who committed with different names or email addresses, see Aggregating authors.
Pages
exclude
Default []. Pages that get no authors. Paths are relative to docs_dir and can be globs:
exclude:
- index.md
- subfolder/page.md
- folder/*
fallback_to_empty
Default false. When git or the git repository is not available, log a warning and show no authors, instead of failing the build.
Enabling
enabled
Default true. Set to false to disable the plugin, for example for faster local builds. Use an environment variable to switch it:
plugins:
- git-authors:
enabled: !ENV [ENABLED_GIT_AUTHORS, true]
ENABLED_GIT_AUTHORS=false mkdocs serve
enabled_on_serve
Default true. Set to false to disable the plugin for mkdocs serve only. You may not need to: when mkdocs serve rebuilds the site, the plugin only runs git blame again for pages that changed, or for all pages after a commit or another change to the repository.
enable_parallel_processing
Default true. Run git blame for several pages at the same time, which makes builds of large sites faster. The output is the same. Set to false to run git blame for one page at a time.
strict
Default true. Log problems where the plugin uses a fallback (for example, a page that is not committed yet) as warnings. Set to false to log them as info instead, so that mkdocs build --strict does not fail on them.