mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: use "Comment" schema type for post replies. (#20932)
Previously, we used the schema type "DiscussionForumPosting" for all the posts including replies. This is not recommended as per Google search experts. This commit changes the schema type to "Comment" for replies.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user