Lewati ke konten

Move the Contributor Table to Another File

By default the Bot writes the contributor table into your README.md. A project with many contributors could end up with a very large contributor table that is dominated by contributor avatars (GitHub profile pictures). If the table becomes too large, you may want to move it into its own file.

The same steps work for showing the table in several files, for example a README and a documentation page. This example below shows you how to configure the Bot to store the table in CONTRIBUTORS.md instead of README.md.

  1. Create the CONTRIBUTORS.md file and add the markers that tell the Bot where to store the table

    Create a file called CONTRIBUTORS.md in your repository. Add the table markers where you want the table to appear. The Bot only adds contributor entries between these two comments, so you are free to add anything else around them. The markers look like this:

    # Contributors
    Any markdown content you want can go here, the Bot will only add the contributor table between the markers.
    <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
    <!-- prettier-ignore-start -->
    <!-- markdownlint-disable -->
    <!-- markdownlint-restore -->
    <!-- prettier-ignore-end -->
    <!-- ALL-CONTRIBUTORS-LIST:END -->
    You can also add content after the All Contributors markers.
  2. Update the configuration so it knows about the CONTRIBUTORS.md file

    Open .all-contributorsrc and update the files array to list CONTRIBUTORS.md.

    {
    "files": ["CONTRIBUTORS.md"]
    }

    If you want the table to appear in two files, list both files in the files array:

    {
    "files": ["README.md", "CONTRIBUTORS.md"]
    }

    You can add the contributors table to as many files as you want by adding more file names to the files array.

  3. Remove the table from your README.md file

    If you no longer want the contributor table to be visible in the README.md file, remove the old table and its markers from README.md. If you don’t remove it, the table will remain there but will not get updated because it is no longer listed in the configuration (see above).

    If you move the table to CONTRIBUTORS.md or another file and remove it from the README.md, our specification recommends that you add a prominent link to it from your README.md in addition to a link from the contributors badge.

  4. Commit your configuration and file changes

    Once you have updated the configuration, commit the new CONTRIBUTORS.md file, the configuration file and the README.md file to your default branch. The next time you ask the Bot to add a new contributor, it will create a new table in CONTRIBUTORS.md instead of the README.md file.