Code and repositories / Repository settings
Show a good link preview on X, Slack and Discord
A link to your repository in X, Slack or Discord shows only its name and a small owner image, so few people click it. Give the repository a title, a short text and a large image, and every link to it shows that card.
5 min read
Search engines read the same title and text. Your organization can have its own card too (see Set the preview of an organization).
You need the maintain role or more on the repository.
1. Open Search and SEO
Open the repository, then Settings. Click Search and SEO under Repository, and find the card SEO and social preview.
2. Type a title and a description
Type a Title and a Description.
The Preview next to the fields shows the card while you type. An empty Title or Description shows its default in grey: the name or the description of the repository.
3. Add an image
Under Image, add an image with one of the three tabs:
- Upload: drop a file. It goes into the
social/folder of the assets of the repository, and becomes the image. - Pick asset: open a folder of the assets, then click an image.
- URL: type an
https://URL. To make an image for each page, see Generate an image for each page.

These fields are optional:
- Image alt text: what the image shows, for people who cannot see it. Without it, the card uses the title.
- Card size: Large image shows the image wide, Small image shows it small. By default, the card is large when you set an image.
- X handle: the X account of the project, with or without the
@.
4. Save
Click Save SEO settings. The forge checks the image when you save (see Which images work).
Done
Paste a link to your repository in X, Slack or Discord. The card shows your title, your text and your large image. Each page of the repository shows its own card:
- The home page: your title and your description. They are also the title of the browser tab and the description that search engines read.
- Every other page (an issue, a pull request, a file): the title of that page, your description and your image.
- No image set: a small card with the image of the owner.
Set the preview of an organization
Owners can do this, and members whose role lets them manage the settings.
- On the page of the organization, click Manage organization. The General tab opens.
- Find the card SEO and social preview.
- Type a Title and a Description.
- Under Image, open Upload. For the organization
acme, click Upload to acme/.github, then drop a file. - Click Save SEO settings.
For an organization, the image tabs and the defaults work like this:
- Upload: the image goes into the
social/folder of the assets of the repository.githubof the organization. If that repository does not exist, the forge makes it, as a public repository. - Pick asset: choose a repository of the organization first. The list shows only repositories whose assets everyone can open.
- Defaults: an empty field uses the display name, the description and the image of the organization.
The card shows for links to the page of the organization. Each repository keeps its own settings.
Generate an image for each page
One image for every link works for the home page. But you want each issue and each pull request to show its own title in the image. If you run an image service that draws a card from a title, give the forge a URL with placeholders.
- Open the card SEO and social preview, then the URL tab.
- Type a URL with placeholders, for example
https://og.example.com/card.png?title={title}&repo={repo}. - Click Save SEO settings.
For each page, the forge puts these values in the URL:
| Placeholder | Value |
|---|---|
{owner} | The name of the owner. |
{repo} | The name of the repository. It is empty on the page of an organization. |
{title} | The title of the card. On an issue page, that is the title of the issue and its number. |
{description} | The description of the card. |
{path} | The path of the page. |
Each value is URL-encoded. For example, https://og.example.com/card.png?path={path} on the page /@acme/app/issues/12 becomes https://og.example.com/card.png?path=%2F%40acme%2Fapp%2Fissues%2F12. A name in braces that is not in this list stays as it is.
From the command line
src repo edit and src profile edit --org take the same --seo-* flags:
src repo edit acme/app --seo-title "Acme App" --seo-description "Rockets for everyone" --seo-image asset:social/card.png
src repo edit acme/app --seo-image-alt "The Acme rocket" --seo-card large --seo-x-handle @acme
src repo edit acme/app --seo-image "https://og.example.com/card.png?path={path}"
src profile edit --org acme --seo-image asset:.github/social/card.png
src repo view acme/app
src profile view acme
--seo-imagetakes anhttps://URL, orasset:<path>for an asset of the repository. With--org, it isasset:<repo>/<path>.--seo-cardtakeslargeorsmall.- An empty value removes a setting, for example
--seo-title "". A flag that you leave out keeps its value. src repo viewandsrc profile viewprint the settings that are set.
Over REST, PATCH /api/v1/repos/{owner}/{repo} and PATCH /api/v1/orgs/{org} take a seo object, and the GET of each returns it:
{
"seo": {
"title": "Acme App",
"image": { "kind": "asset", "repo": "app", "path": "social/card.png" },
"card": "large"
}
}
An image URL is { "kind": "url", "template": "https://..." }. A key that you leave out keeps its value, and null or an empty string removes it. Over MCP, update_repo and update_org_profile take the same seo object.
Reference
Which images work
The forge checks the image when you save. It refuses:
- An asset of another repository. Use an asset of this repository.
- An SVG file, because link previews do not show SVG. Use PNG, JPEG, WebP or GIF.
- A hidden asset.
- An asset of a private repository whose assets are not public, because a link preview cannot open it. To fix this, turn on Assets are public (see Who can see your assets).
- A URL that does not start with
https://.
Field limits
| Field | Maximum |
|---|---|
| Title | 120 characters |
| Description | 300 characters |
| Image alt text | 300 characters |
| Image URL | 2048 characters |
| X handle | 15 letters, digits or underscores |