mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 12:03:26 +00:00 
			
		
		
		
	OpenGraph: use repo avatar if exist (#12586)
This commit is contained in:
		| @@ -2254,6 +2254,11 @@ func (repo *Repository) relAvatarLink(e Engine) string { | |||||||
| 	return setting.AppSubURL + "/repo-avatars/" + repo.Avatar | 	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. | // avatarLink returns user avatar absolute link. | ||||||
| func (repo *Repository) avatarLink(e Engine) string { | func (repo *Repository) avatarLink(e Engine) string { | ||||||
| 	link := repo.relAvatarLink(e) | 	link := repo.relAvatarLink(e) | ||||||
|   | |||||||
| @@ -97,7 +97,11 @@ | |||||||
| 		{{end}} | 		{{end}} | ||||||
| 	{{end}} | 	{{end}} | ||||||
| 	<meta property="og:type" content="object" /> | 	<meta property="og:type" content="object" /> | ||||||
|  | 	{{if .Repository.AvatarLink}} | ||||||
|  | 		<meta property="og:image" content="{{.Repository.AvatarLink}}" /> | ||||||
|  | 	{{else}} | ||||||
| 		<meta property="og:image" content="{{.Repository.Owner.AvatarLink}}" /> | 		<meta property="og:image" content="{{.Repository.Owner.AvatarLink}}" /> | ||||||
|  | 	{{end}} | ||||||
| {{else}} | {{else}} | ||||||
| 	<meta property="og:title" content="{{AppName}}"> | 	<meta property="og:title" content="{{AppName}}"> | ||||||
| 	<meta property="og:type" content="website" /> | 	<meta property="og:type" content="website" /> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user