discourse/app/views/topics/show.html.erb

58 lines
2.4 KiB
Text

<h1>
<%= render_topic_title(@topic_view.topic) %>
</h1>
<div itemscope itemtype='http://schema.org/BreadcrumbList'>
<% categories_breadcrumb(@topic_view.topic).each_with_index do |c,i| %>
<span itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
<%= link_to c[:url], itemprop: 'item' do %>
<span itemprop='name'><%= c[:name] %></span>
<% end %>
</span>
<meta itemprop='position' content='<%= i + 1 %>'>
<% end %>
</div>
<hr>
<% @topic_view.posts.each do |post| %>
<div itemscope itemtype='http://schema.org/Article'>
<% if (u = post.user) %>
<div class='creator'>
<span>
<a href='<%= Discourse.base_uri %>/users/<%= 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 %>'>
<hr>
<% 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 %>
<% 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') %>
<%= crawlable_meta_data(title: @topic_view.title,
description: @topic_view.summary,
image: @topic_view.image_url) %>
<% end %>
<% content_for(:title) { @topic_view.title } %>