You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Show profile of all contributors to a doc page #6218
domain: content pluginRelated to content plugin emitting metadata for theme consumptionfeatureThis is not a bug or issue with Docusausus, per se. It is a feature request for the future.
We want to show the picture of contributors to our docs so that users get more motivation to contribute to the doc
API design
No response
Have you tried building it?
No
Self-service
I'd be willing to contribute this feature to Docusaurus myself.
Reacted by Sergei Grebnov, Viktor Chernodub, william-will-angi, Galdin Raphael, Phosphorus Moscu, Patt O'Brien, Tobias Büschel, Tim Fisicaro, Kelsey Beyer, Thibault Brocheton and 16 more
So I think displaying the pictures of all contributors is going to be too opinionated. However, we can do this:
Instead of including the last update author & time, we include all authors and their last update timestamps in the metadata;
You can wrap the doc container component to render the list of authors beneath the main content, e.g. by querying the GitHub API and getting their profile pictures.
Reacted by Hsu Wang, Tobias Büschel and Ian Tyler Applebaum
to the metadata but preserve the existing lastUpdatedAt and lastUpdatedBy metadata (make it safe for existing swizzled components & works well with existing options showLastUpdate*), or should we release this as a breaking change, change LastUpdateData to a generic UpdateHistory field, and move the determination of what to display to the theme side?
I'd rather have an updateHistory breaking change instead of duplicating fields
Note it seems looking up for the git history might have performance implications, we can try this on our own site first maybe and see, eventually providing an option to control how much we look back into the history. Is it worth it to include all history entries? Probably not, as that would lead to multiple times the same author, so it's not really an history anymore but rather the last unique users that updated a doc.
Also the git author is a string, and it does not necessarily match your github username (in your case it's author: "Joshua Chen" => I guess GitHub is matching on the email too, so we probably want to include the user email in this author type.
Yes, we need to figure out how GitHub matches git usernames with users. For a while I used username Josh-Cena, and my avatars etc. are still loaded correctly, so I think email also plays a part.
About duplicated authors, I don't know if the full history is useful to keep, but in any case we can first go with filtering out unique author names
Yes, we need to figure out how GitHub matches git usernames with users. For a while I used username Josh-Cena, and my avatars etc. are still loaded correctly, so I think email also plays a part.
changed the title [-]Show profile of all contributors to a doc page in docusaurus[/-][+]Show profile of all contributors to a doc page[/+]on Mar 25, 2022
I've mocked that in a UI design..
We can get the last 3-7 contributor and have the others on request when clicking on "N contributors"
Reacted by Joshua Chen, TheCatLady, Asim Hussain, Viktor Chernodub, Sébastien Lorber, lukedukeus, william-will-angi, Ian Tyler Applebaum, Clay Murphy, brupelo and 13 more
Reacted by Parker Higgins
Reacted by Viktor Chernodub, Alejandro Banzas, lukedukeus, Ian Tyler Applebaum, Clay Murphy, brupelo, Phosphorus Moscu, Tobias Büschel, bigmike36c, kevgliss and 3 more
Love the mockup, great work @osamajandali 👏 Are you thinking that the pop-up window would also indicate who was the original creator of the page and timestamps when contributions were made?
I also wanted to ask if anyone has already started implementing this? And whether it would become part of core docusaurus or a standalone module instead?
It notably allows you to automatically add a frontMatter.authors field to your docs
(in case defining the list of authors manually is not an option)
asyncfunctiongetAuthors(filePath: string){// Do whatever you want here to create a list of authors for each file// you can read Git history if you want, or any other sourcereturn[{name: "Seb",picture: "https://github.com/slorber.png"},{name: "Joshua",picture: "https://github.com/Josh-Cena.png"}]}constconfig: Config={markdown: {parseFrontMatter: async(params)=>{constresult=awaitparams.defaultParseFrontMatter(params);constauthors=awaitgetAuthors(params.filePath);return{
...result,frontMatter: {
...result.frontMatter,
authors,}}}},};exportdefaultconfig;
Then you can swizzle the doc component you want and render that front matter:
Considering it is possible to implement in userland thanks to existing Docusaurus primitives, if we ever add this feature to Docusaurus core, this would only be an "opinionated shortcut" to the above solution.
By opinionated I mean: limited to reading history on Git (and not other VCS), and displaying the authors in some predefined place such as the footer. This also means our opinions won't please everyone.
For this reason, there's no reason to rush implementing this feature officially. I'd rather see a few successful userland implementations first, so that we understand the common denominator of the solutions, which would help us craft a good opinionated solution that please a maximum number of users.
This is also related to #8657 which asks us to render some extra metadata in the blog post footer. Similarly parseFrontMatter can be used.
Reacted by Nik Sumeiko, Robert Rajakone, Parker Higgins, Dan Miller, Zachary Karpinski, Geoffrey Hunter, Abhijeet Singh and Haven Madray
importauthorsGlobalfrom"js-yaml-loader!../../../blog/authors.yml";importReactfrom"react";exportdefaultfunctionAuthors({ authors }){if(!authors||authors.length===0){return<divstyle={{marginTop: 20,marginBottom: 20}}>No authors found.</div>;}// Filter authors based on the authors parameter (list of author keys)constfilteredAuthors=authors.map(authorKey=>{constauthorData=authorsGlobal[authorKey];if(!authorData){console.warn(`Author key "${authorKey}" not found in authors.yml`);returnnull;}return{key: authorKey,
...authorData};}).filter(Boolean);// Remove null entriesif(filteredAuthors.length===0){return<divstyle={{marginTop: 20,marginBottom: 20}}>No valid authors found.</div>;}return(<divstyle={{marginTop: 20,marginBottom: 20}}><b>Authors:</b><divclassName={'row'}>{filteredAuthors.map((author,i)=>(<divclassName={'col col--6'}key={i}style={{display: 'flex',alignItems: 'center'}}><imgsrc={author.image_url}style={{width: 40,height: 40,borderRadius: 40,marginRight: 10}}/><div><ahref={author.url}target={"_blank"}>{author.name}</a><div><small>{author.title}</small></div></div></div>))}</div></div>);}
Register it in src/theme/MDXComponents.js
importReactfrom'react';// Import the original mapperimportMDXComponentsfrom'@theme-original/MDXComponents';importAuthorsfrom'@site/src/components/Authors';exportdefault{// Re-use the default mapping
...MDXComponents,
Authors
};
Use it in the mdx, different topics different authors
<Authors authors={["ky"]} />
# Docusaurus Documentation## Section A1
<Authors authors={["ky"]} />
```javapublicstaticvoid main(String[] args) {
System.out.println("Hello, Docusaurus!");
}
```
This is a simple Java program that prints "Hello, Docusaurus!" to the console.
---## Section A2
<Authors authors={["ky"]} />
```javascriptfunctiongreet() {
console.log("Hello, Docusaurus!");
}
greet();
```
This is a simple JavaScript function that prints "Hello, Docusaurus!" to the console.
domain: content pluginRelated to content plugin emitting metadata for theme consumptionfeatureThis is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Activity
Josh-Cena commentedon Dec 29, 2021
So I think displaying the pictures of all contributors is going to be too opinionated. However, we can do this:
Josh-Cena commentedon Dec 30, 2021
@slorber Let's talk about how the API will look like. Our
DocMetadatatype has the shape:Should we add another field
to the metadata but preserve the existing
lastUpdatedAtandlastUpdatedBymetadata (make it safe for existing swizzled components & works well with existing optionsshowLastUpdate*), or should we release this as a breaking change, changeLastUpdateDatato a genericUpdateHistoryfield, and move the determination of what to display to the theme side?slorber commentedon Dec 30, 2021
I'd rather have an updateHistory breaking change instead of duplicating fields
Note it seems looking up for the git history might have performance implications, we can try this on our own site first maybe and see, eventually providing an option to control how much we look back into the history. Is it worth it to include all history entries? Probably not, as that would lead to multiple times the same author, so it's not really an history anymore but rather the last unique users that updated a doc.
Also the git author is a string, and it does not necessarily match your github username (in your case it's
author: "Joshua Chen"=> I guess GitHub is matching on the email too, so we probably want to include the user email in this author type.Josh-Cena commentedon Dec 30, 2021
Yes, we need to figure out how GitHub matches git usernames with users. For a while I used username
Josh-Cena, and my avatars etc. are still loaded correctly, so I think email also plays a part.About duplicated authors, I don't know if the full history is useful to keep, but in any case we can first go with filtering out unique author names
slorber commentedon Dec 30, 2021
This command does not seem too slow to run locally:
git log --format=%ct,%an,%ae🤷♂️ but it's hard to tell for a lot of files.Maybe we should first write a way to log lifecycle execution duration of all plugins to be able to measure the impact?
That would also be a lot of data to send to the frontend for each file, probably not worth it or at least not something to do by default
Josh-Cena commentedon Dec 30, 2021
Isn't this data tree-shakable if unused?
slorber commentedon Dec 30, 2021
If this is imported/required it won't be tree-shaked even if it's not rendered
IE if it's part of docs metadata it will add weight, so you'd rather find a way to limit the json size.
It's also possible to pass the component an optional json module as props, but that's quite similar in terms of tradeoffs anyway
Josh-Cena commentedon Feb 10, 2022
From #3592, the following would be helpful:
TheCatLady commentedon Feb 10, 2022
GitHub doesn't match on username at all, only email address (of which a GitHub user can have multiple associated with their account): https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-user-account/managing-email-preferences/setting-your-commit-email-address
[-]Show profile of all contributors to a doc page in docusaurus[/-][+]Show profile of all contributors to a doc page[/+]osamajandali commentedon Aug 16, 2022
I've mocked that in a UI design..

We can get the last 3-7 contributor and have the others on request when clicking on "N contributors"
tobiasbueschel commentedon Jan 28, 2023
Love the mockup, great work @osamajandali 👏 Are you thinking that the pop-up window would also indicate who was the original creator of the page and timestamps when contributions were made?
I also wanted to ask if anyone has already started implementing this? And whether it would become part of core docusaurus or a standalone module instead?
atar-axis commentedon Oct 17, 2023
Is this still under development? We would love that too!
milldr commentedon Dec 28, 2023
👍 also interested in this feature
hanarotg commentedon Feb 13, 2024
any updates? I'm looking forward to this feature
slorber commentedon Feb 13, 2024
Technically this can now be implemented in userland thanks to the v3.1 parseFrontMatter hook:
https://docusaurus.io/blog/releases/3.1#parsefrontmatter-hook
It notably allows you to automatically add a
frontMatter.authorsfield to your docs(in case defining the list of authors manually is not an option)
Then you can swizzle the doc component you want and render that front matter:
yarn docusaurus swizzle @docusaurus/theme-classic DocItem/Footer --wrap --typescriptResult:
Runnable sandbox: https://stackblitz.com/edit/github-revkph?file=src%2Ftheme%2FDocItem%2FFooter%2Findex.tsx,docusaurus.config.ts
Considering it is possible to implement in userland thanks to existing Docusaurus primitives, if we ever add this feature to Docusaurus core, this would only be an "opinionated shortcut" to the above solution.
By opinionated I mean: limited to reading history on Git (and not other VCS), and displaying the authors in some predefined place such as the footer. This also means our opinions won't please everyone.
For this reason, there's no reason to rush implementing this feature officially. I'd rather see a few successful userland implementations first, so that we understand the common denominator of the solutions, which would help us craft a good opinionated solution that please a maximum number of users.
This is also related to #8657 which asks us to render some extra metadata in the blog post footer. Similarly
parseFrontMattercan be used.uc-kywong commentedon Jul 14, 2025
Why not create Authors component?
Install
npm i js-yaml-loader.We can reuse the
blog/authors.yml.Create
src/components/Authors/index.jsRegister it in
src/theme/MDXComponents.jsUse it in the mdx, different topics different authors
<Authors authors={["ky"]} /> # Docusaurus Documentation ## Section A1 <Authors authors={["ky"]} /> ```java public static void main(String[] args) { System.out.println("Hello, Docusaurus!"); } ``` This is a simple Java program that prints "Hello, Docusaurus!" to the console. --- ## Section A2 <Authors authors={["ky"]} /> ```javascript function greet() { console.log("Hello, Docusaurus!"); } greet(); ``` This is a simple JavaScript function that prints "Hello, Docusaurus!" to the console.