diff options
author | Otto <otto@codeberg.org> | 2025-01-01 18:48:28 +0100 |
---|---|---|
committer | Otto <otto@codeberg.org> | 2025-01-01 18:48:28 +0100 |
commit | b01f3b9b0518ad9abbdebc6b0fc3560edeec4386 (patch) | |
tree | 49ab410a8dae36867115631b59e60fb953816ce8 /services | |
parent | Merge pull request 'i18n(en): consistency improvements' (#6439) from 0ko/forg... (diff) | |
parent | Update (diff) | |
download | forgejo-b01f3b9b0518ad9abbdebc6b0fc3560edeec4386.tar.xz forgejo-b01f3b9b0518ad9abbdebc6b0fc3560edeec4386.zip |
Merge pull request 'feat: Add summary card for repos and releases' (#6269) from JakobDev/forgejo:repocard into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6269
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
Diffstat (limited to 'services')
-rw-r--r-- | services/context/repo.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/services/context/repo.go b/services/context/repo.go index 45a046eff6..462d843bfc 100644 --- a/services/context/repo.go +++ b/services/context/repo.go @@ -25,6 +25,7 @@ import ( unit_model "code.gitea.io/gitea/models/unit" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/cache" + "code.gitea.io/gitea/modules/card" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/gitrepo" code_indexer "code.gitea.io/gitea/modules/indexer/code" @@ -632,6 +633,12 @@ func RepoAssignment(ctx *Context) context.CancelFunc { ctx.Data["IsStaringRepo"] = repo_model.IsStaring(ctx, ctx.Doer.ID, repo.ID) } + cardWidth, cardHeight := card.DefaultSize() + 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 repo.IsFork { RetrieveBaseRepo(ctx, repo) if ctx.Written() { |