diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb
index 60670a3cd52..2df22c41421 100644
--- a/app/views/topics/show.html.erb
+++ b/app/views/topics/show.html.erb
@@ -34,85 +34,84 @@
<%= server_plugin_outlet "topic_header" %>
<%- if include_crawler_content? %>
-
- <% @topic_view.posts.each_with_index do |post, idx| %>
- <% if (u = post.user) %>
-
-
-
-
- <% if application_logo_url.present? %>
-
-
-
- <% end %>
+
+
+
'>
+
+
+ <% if application_logo_url.present? %>
+
+
-
- <%= u.username %>
- <%= "(#{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"] || ""
- small_action_href = post_custom_fields["action_code_path"] || ""
- if post.action_code
- %>
- <%= t("js.action_codes.#{post.action_code}", when: "", who: who_username, href: small_action_href).html_safe %>
- <% end %>
-
-
-
-
- <% if post.image_url %>
-
- <% end %>
-
-
-
- <% if post.version > 1 %>
-
- <% else %>
-
- <% end %>
- <%= post.post_number %>
-
-
-
- <%= post.hidden ? t('flagging.user_must_edit').html_safe : post.cooked.html_safe %>
-
-
-
- <% if idx == 0 %>
-
'>
<% end %>
-
-
-
-
- <%= post.like_count > 0 ? t('post.has_likes', count: post.like_count) : '' %>
-
-
-
-
-
-
-
- <% if @topic_view.link_counts[post.id] && @topic_view.link_counts[post.id].filter { |l| l[:reflection] }.length > 0 %>
-
- <% @topic_view.link_counts[post.id].each_with_index do |link, i| %>
- <% if link[:reflection] && link[:title].present? %>
-
- <% end %>
- <% end %>
-
- <% end %>
- <% end %>
- <% end %>
+
+ <% @topic_view.posts.each do |post| %>
+ <% if (u = post.user) %>
+
class='topic-body crawler-post'>
+
+
+ <%= u.username %>
+ <%= "(#{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"] || ""
+ small_action_href = post_custom_fields["action_code_path"] || ""
+ if post.action_code
+ %>
+ <%= t("js.action_codes.#{post.action_code}", when: "", who: who_username, href: small_action_href).html_safe %>
+ <% end %>
+
+
+
+
+ <% if post.image_url %>
+
+ <% end %>
+
+
+
+ <% if post.version > 1 %>
+
+ <% else %>
+
+ <% end %>
+ <%= post.post_number %>
+
+
+
'>
+ <%= post.hidden ? t('flagging.user_must_edit').html_safe : post.cooked.html_safe %>
+
+
+
+
+
+ <%= post.like_count > 0 ? t('post.has_likes', count: post.like_count) : '' %>
+
+
+
+
+
+
+
+ <% if @topic_view.link_counts[post.id] && @topic_view.link_counts[post.id].filter { |l| l[:reflection] }.length > 0 %>
+
+ <% @topic_view.link_counts[post.id].each_with_index do |link, i| %>
+ <% if link[:reflection] && link[:title].present? %>
+
+ <% end %>
+ <% end %>
+
+ <% end %>
+
+ <% end %>
+ <% end %>
+
<% if @topic_view.prev_page || @topic_view.next_page %>
diff --git a/spec/views/topics/show.html.erb_spec.rb b/spec/views/topics/show.html.erb_spec.rb
index e2293544417..d4a401b1395 100644
--- a/spec/views/topics/show.html.erb_spec.rb
+++ b/spec/views/topics/show.html.erb_spec.rb
@@ -43,4 +43,21 @@ RSpec.describe "topics/show.html.erb" do
expect(first_item.css('[itemprop="position"]')[0]["content"]).to eq("1")
expect(first_item.css('[itemprop="url"]')[0]["href"]).to eq("https://example.com/")
end
+
+ it "uses comment scheme type for replies" do
+ view.stubs(:crawler_layout?).returns(true)
+ view.stubs(:include_crawler_content?).returns(true)
+ Fabricate(:post, topic: topic)
+ Fabricate(:post, topic: topic)
+ Fabricate(:post, topic: topic)
+ assign(:topic_view, TopicView.new(topic))
+ assign(:tags, [])
+
+ render template: "topics/show", formats: [:html]
+
+ doc = Nokogiri::HTML5.fragment(rendered)
+ topic_schema = doc.css('[itemtype="http://schema.org/DiscussionForumPosting"]')
+ expect(topic_schema.size).to eq(1)
+ expect(topic_schema.css('[itemtype="http://schema.org/Comment"]').size).to eq(2)
+ end
end