summaryrefslogtreecommitdiffstats
path: root/templates/base
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2024-12-14 19:36:09 +0100
committerJakobDev <jakobdev@gmx.de>2024-12-14 19:36:09 +0100
commit7685a1e98e96a2602d7b50cd767d18e0d1d86128 (patch)
treeceaf506defbadfc00621099f7e45463143b847ca /templates/base
parentMerge pull request 'Regular visual regression testing' (#6117) from fnetx/pla... (diff)
downloadforgejo-7685a1e98e96a2602d7b50cd767d18e0d1d86128.tar.xz
forgejo-7685a1e98e96a2602d7b50cd767d18e0d1d86128.zip
feat: Add summary card for repos and releases
Diffstat (limited to 'templates/base')
-rw-r--r--templates/base/head_opengraph.tmpl24
1 files changed, 20 insertions, 4 deletions
diff --git a/templates/base/head_opengraph.tmpl b/templates/base/head_opengraph.tmpl
index be9829bf97..bcdfa25695 100644
--- a/templates/base/head_opengraph.tmpl
+++ b/templates/base/head_opengraph.tmpl
@@ -1,4 +1,16 @@
{{- /* og:description - a one to two sentence description of your object, maybe it only needs at most 300 bytes */ -}}
+{{if .OpenGraphTitle}}
+ <meta property="og:title" content="{{.OpenGraphTitle}}">
+{{end}}
+{{if .OpenGraphDescription}}
+ <meta property="og:description" content="{{.OpenGraphDescription}}">
+{{end}}
+{{if .OpenGraphURL}}
+ <meta property="og:url" content="{{.OpenGraphURL}}">
+{{end}}
+{{if .OpenGraphImageURL}}
+ <meta property="og:image" content="{{.OpenGraphImageURL}}">
+{{end}}
{{if .PageIsUserProfile}}
<meta property="og:title" content="{{.ContextUser.DisplayName}}">
<meta property="og:type" content="profile">
@@ -35,14 +47,18 @@
<meta property="og:description" content="{{StringUtils.EllipsisString .Repository.Description 300}}">
{{end}}
{{else}}
- <meta property="og:title" content="{{.Repository.Name}}">
- <meta property="og:url" content="{{.Repository.HTMLURL}}">
- {{if .Repository.Description}}
+ {{if not .OpenGraphTitle}}
+ <meta property="og:title" content="{{.Repository.Name}}">
+ {{end}}
+ {{if not .OpenGraphURL}}
+ <meta property="og:url" content="{{.Repository.HTMLURL}}">
+ {{end}}
+ {{if and (.Repository.Description) (not .OpenGraphDescription)}}
<meta property="og:description" content="{{StringUtils.EllipsisString .Repository.Description 300}}">
{{end}}
{{end}}
<meta property="og:type" content="object">
- {{if not .Issue}}
+ {{if and (not .Issue) (not .OpenGraphImageURL)}}
{{if (.Repository.AvatarLink ctx)}}
<meta property="og:image" content="{{.Repository.AvatarLink ctx}}">
{{else}}