diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index 8eebaebd70..c3645209cd 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -25,42 +25,7 @@
.ui.secondary.menu .dropdown.item > .menu { margin-top: 0; }
-{{if .PageIsUserProfile}}
-
-
-
-
- {{if .ContextUser.Description}}
-
- {{end}}
-{{else if .Repository}}
- {{if .Issue}}
-
-
- {{if .Issue.Content}}
-
- {{end}}
- {{else}}
-
-
- {{if .Repository.Description}}
-
- {{end}}
- {{end}}
-
- {{if (.Repository.AvatarLink ctx)}}
-
- {{else}}
-
- {{end}}
-{{else}}
-
-
-
-
-
-{{end}}
-
+ {{template "base/head_opengraph" .}}
{{template "base/head_style" .}}
{{template "custom/header" .}}
diff --git a/templates/base/head_opengraph.tmpl b/templates/base/head_opengraph.tmpl
new file mode 100644
index 0000000000..fc3958b6b6
--- /dev/null
+++ b/templates/base/head_opengraph.tmpl
@@ -0,0 +1,42 @@
+{{if .PageIsUserProfile}}
+
+
+
+
+ {{if .ContextUser.Description}}
+
+ {{end}}
+{{else if .Repository}}
+ {{if .Issue}}
+
+
+ {{if .Issue.Content}}
+
+ {{end}}
+ {{else if or .PageIsDiff .IsViewFile}}
+
+
+ {{if and .PageIsDiff (IsMultilineCommitMessage .Commit.Message)}}
+
+ {{end}}
+ {{else}}
+
+
+ {{if .Repository.Description}}
+
+ {{end}}
+ {{end}}
+
+ {{if (.Repository.AvatarLink ctx)}}
+
+ {{else}}
+
+ {{end}}
+{{else}}
+
+
+
+
+
+{{end}}
+