mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 13:08:40 +08:00
Follow-up to #37849 which added og:image:width and og:image:height. This adds the og:image:type structured property as well, providing the image MIME type (e.g. image/jpeg, image/png) derived from the upload's extension via MiniMime. Also adds image_width, image_height, and image_type helper methods to TopicView so views don't have to reach into the upload directly, and reformats crawlable_meta_data calls in views to one argument per line for readability. https://meta.discourse.org/t/395484
48 lines
1.6 KiB
Text
Vendored
48 lines
1.6 KiB
Text
Vendored
<!DOCTYPE html>
|
|
<html lang="<%= html_lang %>">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title><%= @topic_view.topic.title %></title>
|
|
<%= raw crawlable_meta_data(
|
|
title: @topic_view.title,
|
|
description: @topic_view.summary(strip_images: true),
|
|
image: @topic_view.image_url,
|
|
image_width: @topic_view.image_width,
|
|
image_height: @topic_view.image_height,
|
|
image_type: @topic_view.image_type,
|
|
read_time: @topic_view.read_time,
|
|
like_count: @topic_view.like_count,
|
|
published_time: @topic_view.published_time,
|
|
) %>
|
|
<% if @topic_view.prev_page %>
|
|
<link rel="prev" href="<%= @topic_view.prev_page_path -%>">
|
|
<% end %>
|
|
<% if @topic_view.next_page %>
|
|
<link rel="next" href="<%= @topic_view.next_page_path -%>">
|
|
<% end %>
|
|
</head>
|
|
<body>
|
|
<% @topic_view.posts.each do |post| %>
|
|
<% if post.user %>
|
|
<div class='creator'>
|
|
<b><%= post.user.username %></b> <%= "(#{post.user.name})" if (SiteSetting.display_name_on_posts && SiteSetting.enable_names?) %> at <%= post.created_at.to_formatted_s(:long_ordinal) %> — #<%= post.post_number %>
|
|
</div>
|
|
<div class='post'>
|
|
<% if post.hidden %>
|
|
<%= t('flagging.user_must_edit').html_safe %>
|
|
<% else %>
|
|
<%= post.cooked.html_safe %>
|
|
<% end %>
|
|
</div>
|
|
<hr/>
|
|
<% end %>
|
|
<% end %>
|
|
<p>
|
|
<% if @topic_view.prev_page %>
|
|
<%= link_to t(:prev_page), @topic_view.prev_page_path, rel: 'prev' %>
|
|
<% end %>
|
|
<% if @topic_view.next_page %>
|
|
<b><%= link_to t(:next_page), @topic_view.next_page_path, rel: 'next' %></b>
|
|
<% end %>
|
|
</p>
|
|
</body>
|