mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-07-24 20:19:39 +02:00
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:
parent
14309837d4
commit
b6c6981c30
3 changed files with 8 additions and 3 deletions
|
@ -644,7 +644,11 @@ func RepoAssignment(ctx *Context) context.CancelFunc {
|
|||
ctx.Data["OpenGraphImageURL"] = repo.SummaryCardURL()
|
||||
ctx.Data["OpenGraphImageWidth"] = cardWidth
|
||||
ctx.Data["OpenGraphImageHeight"] = cardHeight
|
||||
ctx.Data["OpenGraphImageAltText"] = ctx.Tr("repo.summary_card_alt", repo.FullName())
|
||||
if util.IsEmptyString(repo.Description) {
|
||||
ctx.Data["OpenGraphImageAltText"] = ctx.Tr("repo.summary_card_alt", repo.FullName())
|
||||
} else {
|
||||
ctx.Data["OpenGraphImageAltText"] = ctx.Tr("og.repo.summary_card.alt_description", repo.FullName(), repo.Description)
|
||||
}
|
||||
|
||||
if repo.IsFork {
|
||||
RetrieveBaseRepo(ctx, repo)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue