2019-07-04 16:12:39 +08:00
|
|
|
<% if @topic_view %>
|
|
|
|
<h1 class="crawler-topic-title">
|
|
|
|
<%= 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" class='badge-wrapper bullet'>
|
|
|
|
<span class="badge-category-bg"></span>
|
|
|
|
<span itemprop="title" class='category-title'><%=c[:name]%></span>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2013-04-12 04:04:20 +08:00
|
|
|
<% end %>
|
2016-04-26 03:55:15 +08:00
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<% if SiteSetting.tagging_enabled %>
|
|
|
|
<% @tags = @topic_view.topic.tags %>
|
|
|
|
<% if @tags.present? %>
|
|
|
|
<div class='crawler-tags-list' itemscope itemtype='http://schema.org/DiscussionForumPosting'>
|
|
|
|
<% @tags.each_with_index do |tag, i| %>
|
|
|
|
<div itemprop='keywords'>
|
|
|
|
<a href='<%= "#{Discourse.base_url}/tags/#{tag.name}" %>' rel="tag">
|
|
|
|
<span itemprop='headline'><%= tag.name -%></span>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2017-02-07 07:10:42 +08:00
|
|
|
<% end %>
|
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<%= server_plugin_outlet "topic_header" %>
|
|
|
|
|
|
|
|
<%- if include_crawler_content? %>
|
|
|
|
|
|
|
|
<% @topic_view.posts.each do |post| %>
|
|
|
|
<div itemscope itemtype='http://schema.org/DiscussionForumPosting' class='topic-body crawler-post'>
|
|
|
|
<% if (u = post.user) %>
|
|
|
|
<div class='crawler-post-meta'>
|
|
|
|
<span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person">
|
|
|
|
<a itemprop="url" href='<%= Discourse.base_uri %>/u/<%= u.username %>'><span itemprop='name'><%= u.username %></span></a>
|
|
|
|
<%= "(#{u.name})" if (SiteSetting.display_name_on_posts && SiteSetting.enable_names? && !u.name.blank?) %>
|
|
|
|
<%
|
|
|
|
post_custom_fields = @topic_view.post_custom_fields[post.id] || {}
|
|
|
|
who_username = post_custom_fields["action_code_who"] || ""
|
|
|
|
if post.action_code
|
|
|
|
%>
|
|
|
|
<%= t("js.action_codes.#{post.action_code}", when: "", who: who_username).html_safe %>
|
|
|
|
<% end %>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span class="crawler-post-infos">
|
|
|
|
<% if post.updated_at > post.created_at %>
|
|
|
|
<meta itemprop='datePublished' content='<%= post.created_at.to_formatted_s(:iso8601) %>'>
|
|
|
|
<time itemprop='dateModified' datetime='<%= post.updated_at.to_formatted_s(:iso8601) %>' class='post-time'>
|
|
|
|
<%= l post.updated_at, format: :long %>
|
|
|
|
</time>
|
|
|
|
<% else %>
|
|
|
|
<time itemprop='datePublished' datetime='<%= post.created_at.to_formatted_s(:iso8601) %>' class='post-time'>
|
|
|
|
<%= l post.created_at, format: :long %>
|
|
|
|
</time>
|
|
|
|
<% end %>
|
|
|
|
<span itemprop='position'>#<%= post.post_number %></span>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class='post' itemprop='articleBody'>
|
|
|
|
<%= post.hidden ? t('flagging.user_must_edit').html_safe : post.cooked.html_safe %>
|
|
|
|
</div>
|
2019-06-03 10:03:16 +08:00
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<meta itemprop='headline' content='<%= @topic_view.title %>'>
|
2019-06-03 10:03:16 +08:00
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter">
|
|
|
|
<meta itemprop="interactionType" content="http://schema.org/LikeAction"/>
|
|
|
|
<meta itemprop="userInteractionCount" content="<%= post.like_count %>" />
|
|
|
|
<span class='post-likes'><%= post.like_count > 0 ? t('post.has_likes', count: post.like_count) : '' %></span>
|
|
|
|
</div>
|
2019-06-03 10:03:16 +08:00
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter">
|
|
|
|
<meta itemprop="interactionType" content="http://schema.org/CommentAction"/>
|
|
|
|
<meta itemprop="userInteractionCount" content="<%= post.reply_count %>" />
|
|
|
|
</div>
|
2019-06-03 10:03:16 +08:00
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<% if @topic_view.link_counts[post.id] && @topic_view.link_counts[post.id].length > 0 %>
|
|
|
|
<div class='crawler-linkback-list' itemscope itemtype='http://schema.org/ItemList'>
|
|
|
|
<% @topic_view.link_counts[post.id].each_with_index do |link, i| %>
|
|
|
|
<% if link[:reflection] && link[:title].present? %>
|
|
|
|
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
|
|
|
|
<a href="<%=link[:url]%>" itemprop='item'>
|
|
|
|
<meta itemprop='url' content='<%=link[:url]%>'>
|
|
|
|
<meta itemprop='position' content='<%= i+1 %>'>
|
|
|
|
<span itemprop='name'><%=link[:title]%></span>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2019-06-03 10:03:16 +08:00
|
|
|
<% end %>
|
2019-07-04 16:12:39 +08:00
|
|
|
</div>
|
|
|
|
<% end %>
|
2019-06-03 10:03:16 +08:00
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2014-03-01 18:16:40 +08:00
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<% if @topic_view.prev_page || @topic_view.next_page %>
|
|
|
|
<div role='navigation' itemscope itemtype='http://schema.org/SiteNavigationElement' class="topic-body crawler-post">
|
|
|
|
<% if @topic_view.prev_page %>
|
|
|
|
<span itemprop='name'><%= link_to t(:prev_page), @topic_view.prev_page_path, rel: 'prev', itemprop: 'url' %></span>
|
|
|
|
<% end %>
|
|
|
|
<% if @topic_view.next_page %>
|
|
|
|
<span itemprop='name'><b><%= link_to t(:next_page), @topic_view.next_page_path, rel: 'next', itemprop: 'url' %></b></span>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2013-02-13 14:43:21 +08:00
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<% end %>
|
2015-11-09 11:55:17 +08:00
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<% 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(strip_images: true), image: @topic_view.image_url, read_time: @topic_view.read_time, like_count: @topic_view.like_count, ignore_canonical: true, published_time: @topic_view.published_time) %>
|
2017-02-08 05:11:06 +08:00
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<% 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 %>
|
2017-02-08 05:11:06 +08:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2013-03-19 02:24:27 +08:00
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<% content_for(:title) { @title || "#{gsub_emoji_to_unicode(@topic_view.page_title)} - #{SiteSetting.title}" } %>
|
2016-08-01 13:06:55 +08:00
|
|
|
|
2019-07-04 16:12:39 +08:00
|
|
|
<% if @topic_view.print %>
|
|
|
|
<% content_for :after_body do %>
|
|
|
|
<%= preload_script('print-page') %>
|
|
|
|
<% end %>
|
2016-08-01 13:06:55 +08:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|