From 4b97f9018b51c1ef56c16154931123aac6080445 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 24 Aug 2020 21:46:56 +0200 Subject: [PATCH] OpenGraph: use repo avatar if exist (#12586) --- models/repo.go | 5 +++++ templates/base/head.tmpl | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/models/repo.go b/models/repo.go index b9ebec8be9..d9b6576976 100644 --- a/models/repo.go +++ b/models/repo.go @@ -2254,6 +2254,11 @@ func (repo *Repository) relAvatarLink(e Engine) string { return setting.AppSubURL + "/repo-avatars/" + repo.Avatar } +// AvatarLink returns a link to the repository's avatar. +func (repo *Repository) AvatarLink() string { + return repo.avatarLink(x) +} + // avatarLink returns user avatar absolute link. func (repo *Repository) avatarLink(e Engine) string { link := repo.relAvatarLink(e) diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 8c14ccfb6d..5f27779235 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -97,7 +97,11 @@ {{end}} {{end}} - + {{if .Repository.AvatarLink}} + + {{else}} + + {{end}} {{else}}