mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Improve OGP (#8637)
* Improve OGP * Ensure Repo is loaded when checking Pull info Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
		@@ -242,6 +242,10 @@ func checkPullInfo(ctx *context.Context) *models.Issue {
 | 
				
			|||||||
		ctx.ServerError("LoadPoster", err)
 | 
							ctx.ServerError("LoadPoster", err)
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if err := issue.LoadRepo(); err != nil {
 | 
				
			||||||
 | 
							ctx.ServerError("LoadRepo", err)
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	ctx.Data["Title"] = fmt.Sprintf("#%d - %s", issue.Index, issue.Title)
 | 
						ctx.Data["Title"] = fmt.Sprintf("#%d - %s", issue.Index, issue.Title)
 | 
				
			||||||
	ctx.Data["Issue"] = issue
 | 
						ctx.Data["Issue"] = issue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -131,16 +131,25 @@
 | 
				
			|||||||
	<meta property="og:type" content="profile" />
 | 
						<meta property="og:type" content="profile" />
 | 
				
			||||||
	<meta property="og:image" content="{{.Owner.AvatarLink}}" />
 | 
						<meta property="og:image" content="{{.Owner.AvatarLink}}" />
 | 
				
			||||||
	<meta property="og:url" content="{{.Owner.HTMLURL}}" />
 | 
						<meta property="og:url" content="{{.Owner.HTMLURL}}" />
 | 
				
			||||||
	<meta property="og:site_name" content="{{AppName}}" />
 | 
						{{if .Owner.Description}}
 | 
				
			||||||
 | 
							<meta property="og:description" content="{{.Owner.Description}}">
 | 
				
			||||||
 | 
						{{end}}
 | 
				
			||||||
{{else if .Repository}}
 | 
					{{else if .Repository}}
 | 
				
			||||||
 | 
						{{if .Issue}}
 | 
				
			||||||
 | 
							<meta property="og:title" content="{{.Issue.Title}}" />
 | 
				
			||||||
 | 
							<meta property="og:url" content="{{.Issue.HTMLURL}}" />
 | 
				
			||||||
 | 
							{{if .Issue.Content}}
 | 
				
			||||||
 | 
								<meta property="og:description" content="{{.Issue.Content}}" />
 | 
				
			||||||
 | 
							{{end}}
 | 
				
			||||||
 | 
						{{else}}
 | 
				
			||||||
		<meta property="og:title" content="{{.Repository.Name}}" />
 | 
							<meta property="og:title" content="{{.Repository.Name}}" />
 | 
				
			||||||
	<meta property="og:type" content="object" />
 | 
					 | 
				
			||||||
	<meta property="og:image" content="{{.Repository.Owner.AvatarLink}}" />
 | 
					 | 
				
			||||||
		<meta property="og:url" content="{{.Repository.HTMLURL}}" />
 | 
							<meta property="og:url" content="{{.Repository.HTMLURL}}" />
 | 
				
			||||||
		{{if .Repository.Description}}
 | 
							{{if .Repository.Description}}
 | 
				
			||||||
			<meta property="og:description" content="{{.Repository.Description}}" />
 | 
								<meta property="og:description" content="{{.Repository.Description}}" />
 | 
				
			||||||
		{{end}}
 | 
							{{end}}
 | 
				
			||||||
	<meta property="og:site_name" content="{{AppName}}" />
 | 
						{{end}}
 | 
				
			||||||
 | 
						<meta property="og:type" content="object" />
 | 
				
			||||||
 | 
						<meta property="og:image" content="{{.Repository.Owner.AvatarLink}}" />
 | 
				
			||||||
{{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" />
 | 
				
			||||||
@@ -148,6 +157,7 @@
 | 
				
			|||||||
	<meta property="og:url" content="{{AppUrl}}" />
 | 
						<meta property="og:url" content="{{AppUrl}}" />
 | 
				
			||||||
	<meta property="og:description" content="{{MetaDescription}}">
 | 
						<meta property="og:description" content="{{MetaDescription}}">
 | 
				
			||||||
{{end}}
 | 
					{{end}}
 | 
				
			||||||
 | 
					<meta property="og:site_name" content="{{AppName}}" />
 | 
				
			||||||
{{if .IsSigned }}
 | 
					{{if .IsSigned }}
 | 
				
			||||||
	{{ if ne .SignedUser.Theme "gitea" }}
 | 
						{{ if ne .SignedUser.Theme "gitea" }}
 | 
				
			||||||
		<link rel="stylesheet" href="{{StaticUrlPrefix}}/css/theme-{{.SignedUser.Theme}}.css">
 | 
							<link rel="stylesheet" href="{{StaticUrlPrefix}}/css/theme-{{.SignedUser.Theme}}.css">
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user