forked from NYANDEV/forgejo
Implement basic Open Graph support. (#901)
This commit is contained in:
parent
8a0be5e9f0
commit
3f67676059
2 changed files with 29 additions and 0 deletions
|
@ -252,6 +252,11 @@ func (u *User) HomeLink() string {
|
||||||
return setting.AppSubURL + "/" + u.Name
|
return setting.AppSubURL + "/" + u.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HTMLURL returns the user or organization's full link.
|
||||||
|
func (u *User) HTMLURL() string {
|
||||||
|
return setting.AppURL + u.Name
|
||||||
|
}
|
||||||
|
|
||||||
// GenerateEmailActivateCode generates an activate code based on user information and given e-mail.
|
// GenerateEmailActivateCode generates an activate code based on user information and given e-mail.
|
||||||
func (u *User) GenerateEmailActivateCode(email string) string {
|
func (u *User) GenerateEmailActivateCode(email string) string {
|
||||||
code := base.CreateTimeLimitCode(
|
code := base.CreateTimeLimitCode(
|
||||||
|
|
|
@ -46,6 +46,30 @@
|
||||||
<link rel="stylesheet" href="{{AppSubUrl}}/plugins/dropzone-4.2.0/dropzone.css">
|
<link rel="stylesheet" href="{{AppSubUrl}}/plugins/dropzone-4.2.0/dropzone.css">
|
||||||
{{end}}
|
{{end}}
|
||||||
<style class="list-search-style"></style>
|
<style class="list-search-style"></style>
|
||||||
|
|
||||||
|
<!-- Open Graph -->
|
||||||
|
{{if .PageIsUserProfile}}
|
||||||
|
<meta property="og:title" content="{{.Owner.Name}}" />
|
||||||
|
<meta property="og:type" content="profile" />
|
||||||
|
<meta property="og:image" content="{{.Owner.AvatarLink}}" />
|
||||||
|
<meta property="og:url" content="{{.Owner.HTMLURL}}" />
|
||||||
|
<meta property="og:site_name" content="{{AppName}}" />
|
||||||
|
{{else if .Repository}}
|
||||||
|
<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}}" />
|
||||||
|
{{if .Repository.Description}}
|
||||||
|
<meta property="og:description" content="{{.Repository.Description}}" />
|
||||||
|
{{end}}
|
||||||
|
<meta property="og:site_name" content="{{AppName}}" />
|
||||||
|
{{else}}
|
||||||
|
<meta property="og:title" content="{{AppName}}">
|
||||||
|
<meta property="og:type" content="website" />
|
||||||
|
<meta property="og:image" content="{{AppSubUrl}}/img/gitea-lg.png" />
|
||||||
|
<meta property="og:url" content="{{AppUrl}}" />
|
||||||
|
<meta property="og:description" content="Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go">
|
||||||
|
{{end}}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="full height">
|
<div class="full height">
|
||||||
|
|
Loading…
Reference in a new issue