mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 00:23:56 +08:00
120 lines
4.3 KiB
Plaintext
120 lines
4.3 KiB
Plaintext
<h1>
|
|
<%= render_topic_title(@topic_view.topic) %>
|
|
</h1>
|
|
|
|
<% @breadcrumbs = categories_breadcrumb(@topic_view.topic)
|
|
if @breadcrumbs.present? %>
|
|
<div id='breadcrumbs'>
|
|
<% @breadcrumbs.each_with_index do |c,i| %>
|
|
<div id="breadcrumb-<%=i%>" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"
|
|
<%-if (i+1) < @breadcrumbs.length%>
|
|
itemref="breadcrumb-<%=(i+1)%>"
|
|
<%-end%>>
|
|
<a href="<%=c[:url]%>" itemprop="url">
|
|
<span itemprop="title"><%=c[:name]%></span>
|
|
</a>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% if SiteSetting.tagging_enabled %>
|
|
<% @tags = @topic_view.topic.tags %>
|
|
<% if @tags.present? %>
|
|
<div class='tags-list' itemscope itemtype='http://schema.org/ItemList'>
|
|
<% @tags.each do |tag| %>
|
|
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
|
|
<meta itemprop='url' content='<%= "#{Discourse.base_url}/tags/#{tag.name}" %>'>
|
|
<a href='<%= "#{Discourse.base_url}/tags/#{tag.name}" %>' itemprop='item'>
|
|
<span itemprop='name'><%= tag.name -%></span>
|
|
</a>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
|
|
<%= server_plugin_outlet "topic_header" %>
|
|
|
|
<hr>
|
|
|
|
<%- if include_crawler_content? %>
|
|
|
|
<% @topic_view.posts.each do |post| %>
|
|
<div itemscope itemtype='http://schema.org/DiscussionForumPosting'>
|
|
<% if (u = post.user) %>
|
|
<div class='creator'>
|
|
<span>
|
|
<a href='<%= Discourse.base_uri %>/u/<%= u.username %>'><b itemprop='author'><%= u.username %></b></a>
|
|
<%= "(#{u.name})" if (SiteSetting.display_name_on_posts && SiteSetting.enable_names? && !u.name.blank?) %>
|
|
<time datetime='<%= post.created_at.to_formatted_s(:iso8601) %>' itemprop='datePublished'>
|
|
<%= post.created_at %>
|
|
</time>
|
|
</span>
|
|
<span itemprop='position'>#<%= post.post_number %></span>
|
|
</div>
|
|
<div class='post' itemprop='articleBody'>
|
|
<%= post.hidden ? t('flagging.user_must_edit').html_safe : post.cooked.html_safe %>
|
|
</div>
|
|
<meta itemprop='interactionCount' content='UserLikes:<%= post.like_count %>'>
|
|
<meta itemprop='interactionCount' content='UserComments:<%= post.reply_count %>'>
|
|
<meta itemprop='headline' content='<%= @topic_view.title %>'>
|
|
<hr>
|
|
<% if @topic_view.link_counts[post.id] && @topic_view.link_counts[post.id].length > 0 %>
|
|
<% @topic_view.link_counts[post.id].each do |link| %>
|
|
<% if link[:reflection] && link[:title].present? %>
|
|
<a href="<%=link[:url]%>"><%=link[:title]%></a>
|
|
<hr>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% if @topic_view.prev_page || @topic_view.next_page %>
|
|
<div role='navigation' itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
|
<% if @topic_view.prev_page %>
|
|
<span itemprop='url'><%= link_to t(:prev_page), @topic_view.prev_page_path, rel: 'prev', itemprop: 'name' %></span>
|
|
<% end %>
|
|
<% if @topic_view.next_page %>
|
|
<span itemprop='url'><b><%= link_to t(:next_page), @topic_view.next_page_path, rel: 'next', itemprop: 'name' %></b></span>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% content_for :head do %>
|
|
<%= auto_discovery_link_tag(@topic_view, {action: :feed, slug: @topic_view.topic.slug, topic_id: @topic_view.topic.id}, title: t('rss_posts_in_topic', topic: @topic_view.title), type: 'application/rss+xml') %>
|
|
<%= raw crawlable_meta_data(title: @topic_view.title, description: @topic_view.summary, image: @topic_view.image_url, read_time: @topic_view.read_time, like_count: @topic_view.like_count) %>
|
|
|
|
<% if @topic_view.prev_page || @topic_view.next_page %>
|
|
<% 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 %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% content_for(:title) { "#{gsub_emoji_to_unicode(@topic_view.page_title)}" } %>
|
|
|
|
<% if @topic_view.print %>
|
|
<% content_for :after_body do %>
|
|
<style media="print">
|
|
/* For readability */
|
|
a, a:visited {
|
|
color: #0088cc !important;
|
|
}
|
|
</style>
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
window.print();
|
|
});
|
|
</script>
|
|
<% end %>
|
|
<% end %>
|