Copy Repo Button Customization
About 256 wordsLess than 1 minute
Customize the appearance of the Copy Repo button to make your template repository more appealing.
Use Cases
- Customize the Copy Repo button for template or example repositories
- Guide users to quickly copy the repository
- Enhance user experience with personalized hover images
Prerequisites
The "Copy Repo" button is not displayed by default on the repository homepage. To add this button, edit the repository description on the right side of the homepage and add the example tag. It is recommended for repositories that can serve as templates or examples.
Clicking this button provides a quick way to copy the repository.
Configuration
Add the copyRepo configuration to .cnb/settings.yml:
.cnb/settings.yml
# Copy Repo button configuration, reads the .cnb/settings.yml configuration from the repository's default branch
copyRepo:
# Customize the "Copy Repo" button
button:
# Button description
description: Your repo is great, now it's mine
# Image displayed when hovering over the button
# 1.Use images from the repository's default branch, specify the path relative to the repository root directory, e.g., .cnb/copy-hover.png;
# 2.Use the raw file address under the current domain name, for example: https://cnb.cool/my/test/-/git/raw/main/copy-hover.png
# Maximum image size: 10MB
hoverImage: ".cnb/copy-hover.png"Parameter Reference
| Parameter | Type | Default | Description |
|---|---|---|---|
copyRepo.button.description | string | - | The description text of the Copy Repo button |
copyRepo.button.hoverImage | string | - | Image displayed on hover. Supports repository relative path or raw URL, max 10MB |