opengraph meta tags
This commit is contained in:
@@ -11,6 +11,37 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if log_entry && is_renderable_image_type?(log_entry.content_type) && (log_entry.status_code == 200) && (blob_entry = log_entry.response) %>
|
||||||
|
<% path = blob_url(
|
||||||
|
HexUtil.bin2hex(blob_entry.sha256),
|
||||||
|
format: extension_for_content_type(blob_entry.content_type),
|
||||||
|
thumb: "content-container",
|
||||||
|
)
|
||||||
|
%>
|
||||||
|
<meta name="og:image" content="<%= path %>">
|
||||||
|
<meta name="og:image:type" content="image/jpeg">
|
||||||
|
<meta name="og:image:width" content="1200">
|
||||||
|
<meta name="og:image:height" content="630">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="<%= path %>">
|
||||||
|
<meta name="twitter:image:alt" content="<%= @post.title %>">
|
||||||
|
<% end %>
|
||||||
|
<%
|
||||||
|
description = []
|
||||||
|
description << "posted #{@post.posted_at.strftime("%B %d, %Y")}" if @post.respond_to?(:posted_at) && @post.posted_at.present?
|
||||||
|
description << "by #{@post.primary_creator_for_view&.name || "Unknown"}"
|
||||||
|
description << "@ #{domain_name_for_model(@post)}"
|
||||||
|
%>
|
||||||
|
<meta name="og:description" content="<%= description.join(" ") %>">
|
||||||
|
<meta name="og:url" content="<%= domain_post_url(@post) %>">
|
||||||
|
<meta name="og:type" content="article">
|
||||||
|
<%
|
||||||
|
site_name = "#{domain_name_for_model(@post)} via ReFurrer"
|
||||||
|
%>
|
||||||
|
<meta name="og:title" content="<%= @post.title %>">
|
||||||
|
<meta name="twitter:title" content="<%= @post.title %>">
|
||||||
|
<meta name="og:site_name" content="<%= site_name %>">
|
||||||
|
<meta name="og:locale" content="en_US">
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="mx-auto mt-4 flex w-full max-w-2xl flex-col gap-4 pb-4">
|
<div class="mx-auto mt-4 flex w-full max-w-2xl flex-col gap-4 pb-4">
|
||||||
<%= render_for_model(@post, "section_post_title", as: :post) %>
|
<%= render_for_model(@post, "section_post_title", as: :post) %>
|
||||||
|
|||||||
Reference in New Issue
Block a user