From 7cedb911a7594c2e4a932ed4afdf6ce83aeebcd0 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Thu, 6 Apr 2023 23:30:19 +0530 Subject: [PATCH] FEATURE: add category name in articleSection meta tag for schema. (#21004) https://schema.org/DiscussionForumPosting --- app/views/topics/show.html.erb | 3 +++ spec/views/topics/show.html.erb_spec.rb | 1 + 2 files changed, 4 insertions(+) diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 2df22c41421..5ddec148677 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -36,6 +36,9 @@ <%- if include_crawler_content? %>
+ <% if @topic_view.topic.category.present? %> + + <% end %> '>
diff --git a/spec/views/topics/show.html.erb_spec.rb b/spec/views/topics/show.html.erb_spec.rb index d4a401b1395..026e58ff965 100644 --- a/spec/views/topics/show.html.erb_spec.rb +++ b/spec/views/topics/show.html.erb_spec.rb @@ -59,5 +59,6 @@ RSpec.describe "topics/show.html.erb" do 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) + expect(topic_schema.css('[itemprop="articleSection"]')[0]["content"]).to eq(topic.category.name) end end