mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-06 21:57:51 +09:00
1. `origin-url` was introduced in the past when there was no good
framework support to detect current host url
* It is not needed anymore
* Removing it makes the code clearer
2. Separate template helper functions for different templates (web
page/mail)
3. The "AppURL" info is removed from admin config page: it doesn't
really help.
* We already have various app url checks at many places
48 lines
2.1 KiB
Handlebars
48 lines
2.1 KiB
Handlebars
{{- /* og:description - a one to two sentence description of your object, maybe it only needs at most 300 bytes */ -}}
|
|
{{if .PageIsUserProfile}}
|
|
<meta property="og:title" content="{{.ContextUser.DisplayName}}">
|
|
<meta property="og:type" content="profile">
|
|
<meta property="og:image" content="{{.ContextUser.AvatarLink ctx}}">
|
|
<meta property="og:url" content="{{.ContextUser.HTMLURL ctx}}">
|
|
{{if .ContextUser.Description}}
|
|
<meta property="og:description" content="{{StringUtils.EllipsisString .ContextUser.Description 300}}">
|
|
{{end}}
|
|
{{else if .Repository}}
|
|
{{if .Issue}}
|
|
<meta property="og:title" content="{{.Issue.Title}}">
|
|
<meta property="og:url" content="{{.Issue.HTMLURL ctx}}">
|
|
{{if .Issue.Content}}
|
|
<meta property="og:description" content="{{StringUtils.EllipsisString .Issue.Content 300}}">
|
|
{{end}}
|
|
{{else if or .PageIsDiff .IsViewFile}}
|
|
<meta property="og:title" content="{{.Title}}">
|
|
<meta property="og:url" content="{{ctx.AppFullLink $.Link}}">
|
|
{{if and .PageIsDiff .Commit}}
|
|
{{- $commitMessageParts := StringUtils.Cut .Commit.Message "\n" -}}
|
|
{{- $commitMessageBody := index $commitMessageParts 1 -}}
|
|
{{- if $commitMessageBody -}}
|
|
<meta property="og:description" content="{{StringUtils.EllipsisString $commitMessageBody 300}}">
|
|
{{- end -}}
|
|
{{end}}
|
|
{{else}}
|
|
<meta property="og:title" content="{{.Repository.Name}}">
|
|
<meta property="og:url" content="{{.Repository.HTMLURL ctx}}">
|
|
{{if .Repository.Description}}
|
|
<meta property="og:description" content="{{StringUtils.EllipsisString .Repository.Description 300}}">
|
|
{{end}}
|
|
{{end}}
|
|
<meta property="og:type" content="object">
|
|
{{if (.Repository.AvatarLink ctx)}}
|
|
<meta property="og:image" content="{{.Repository.AvatarLink ctx}}">
|
|
{{else}}
|
|
<meta property="og:image" content="{{.Repository.Owner.AvatarLink ctx}}">
|
|
{{end}}
|
|
{{else}}
|
|
<meta property="og:title" content="{{AppName}}">
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:image" content="{{AssetUrlPrefix}}/img/logo.png">
|
|
<meta property="og:url" content="{{ctx.AppFullLink}}">
|
|
<meta property="og:description" content="{{MetaDescription}}">
|
|
{{end}}
|
|
<meta property="og:site_name" content="{{AppName}}">
|