feat(ui): add repository description to og:image:alt (#8325)

Followup to https://codeberg.org/forgejo/forgejo/pulls/6053

Adds the repository description to the "alt" tag of the OpenGraph summary card, improving accessibility when these images are displayed. Fixes #8192.

Other summary cards, for issues and releases, are not modified as they already contain the issue title or release title, which seems reasonable.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8325
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
This commit is contained in:
Mathieu Fenniak 2025-06-29 05:54:07 +02:00 committed by 0ko
parent 14309837d4
commit b6c6981c30
3 changed files with 8 additions and 3 deletions

View file

@ -98,7 +98,7 @@ func TestOpenGraphProperties(t *testing.T) {
"og:url": setting.AppURL + "/user27/repo49/src/branch/master/test/test.txt",
"og:type": "object",
"og:image": setting.AppURL + "user27/repo49/-/summary-card",
"og:image:alt": "Summary card of repository user27/repo49",
"og:image:alt": "Summary card of repository user27/repo49, described as: A wonderful repository with more than just a README.md",
"og:image:width": "1200",
"og:image:height": "600",
"og:site_name": siteName,
@ -141,7 +141,7 @@ func TestOpenGraphProperties(t *testing.T) {
"og:description": "A wonderful repository with more than just a README.md",
"og:type": "object",
"og:image": setting.AppURL + "user27/repo49/-/summary-card",
"og:image:alt": "Summary card of repository user27/repo49",
"og:image:alt": "Summary card of repository user27/repo49, described as: A wonderful repository with more than just a README.md",
"og:image:width": "1200",
"og:image:height": "600",
"og:site_name": siteName,