Add og:video meta tags for video post embeds
When a post contains a video embed, include og:video, og:video:secure_url, og:video:type (application/vnd.apple.mpegurl), and og:video:width/height meta tags alongside the existing og:image thumbnail. Also sets the Twitter card type to "player" for video posts instead of "summary_large_image". Handles both standalone video embeds and record-with-media video embeds. https://claude.ai/code/session_01H7uYXdTD17cQcfYPHhoWSr
This commit is contained in:
@@ -589,6 +589,11 @@ func (srv *Server) WebPost(c echo.Context) error {
|
||||
if postView.Embed.EmbedVideo_View.Thumbnail != nil {
|
||||
data["imgThumbUrls"] = []string{*postView.Embed.EmbedVideo_View.Thumbnail}
|
||||
}
|
||||
data["videoPlaylistUrl"] = postView.Embed.EmbedVideo_View.Playlist
|
||||
if postView.Embed.EmbedVideo_View.AspectRatio != nil {
|
||||
data["videoWidth"] = postView.Embed.EmbedVideo_View.AspectRatio.Width
|
||||
data["videoHeight"] = postView.Embed.EmbedVideo_View.AspectRatio.Height
|
||||
}
|
||||
} else if hasMediaImages {
|
||||
var thumbUrls []string
|
||||
for i := range postView.Embed.EmbedRecordWithMedia_View.Media.EmbedImages_View.Images {
|
||||
@@ -599,6 +604,11 @@ func (srv *Server) WebPost(c echo.Context) error {
|
||||
if postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.Thumbnail != nil {
|
||||
data["imgThumbUrls"] = []string{*postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.Thumbnail}
|
||||
}
|
||||
data["videoPlaylistUrl"] = postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.Playlist
|
||||
if postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.AspectRatio != nil {
|
||||
data["videoWidth"] = postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.AspectRatio.Width
|
||||
data["videoHeight"] = postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.AspectRatio.Height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,18 @@
|
||||
<meta property="og:image" content="{{ imgThumbUrl }}">
|
||||
<meta property="twitter:image" content="{{ imgThumbUrl }}">
|
||||
{% endfor %}
|
||||
{%- if videoPlaylistUrl %}
|
||||
<meta property="og:video" content="{{ videoPlaylistUrl }}">
|
||||
<meta property="og:video:secure_url" content="{{ videoPlaylistUrl }}">
|
||||
<meta property="og:video:type" content="application/vnd.apple.mpegurl">
|
||||
{%- if videoWidth %}
|
||||
<meta property="og:video:width" content="{{ videoWidth }}">
|
||||
<meta property="og:video:height" content="{{ videoHeight }}">
|
||||
{% endif -%}
|
||||
<meta name="twitter:card" content="player">
|
||||
{% else %}
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
{% endif -%}
|
||||
{% else %}
|
||||
<meta property="og:image" content="{{ postView.Author.Avatar }}">
|
||||
<meta property="twitter:image" content="{{ postView.Author.Avatar }}">
|
||||
|
||||
Reference in New Issue
Block a user