FEATURE: add category name in articleSection meta tag for schema. (#21004)
https://schema.org/DiscussionForumPosting
This commit is contained in:
parent
fef279acd5
commit
7cedb911a7
|
@ -36,6 +36,9 @@
|
||||||
<%- if include_crawler_content? %>
|
<%- if include_crawler_content? %>
|
||||||
<div itemscope itemtype='http://schema.org/DiscussionForumPosting'>
|
<div itemscope itemtype='http://schema.org/DiscussionForumPosting'>
|
||||||
<meta itemprop='headline' content='<%= @topic_view.title %>'>
|
<meta itemprop='headline' content='<%= @topic_view.title %>'>
|
||||||
|
<% if @topic_view.topic.category.present? %>
|
||||||
|
<meta itemprop='articleSection' content='<%= @topic_view.topic.category.name %>'>
|
||||||
|
<% end %>
|
||||||
<meta itemprop='keywords' content='<%= @tags.map(&:name).join(', ') %>'>
|
<meta itemprop='keywords' content='<%= @tags.map(&:name).join(', ') %>'>
|
||||||
<div itemprop='publisher' itemscope itemtype="http://schema.org/Organization">
|
<div itemprop='publisher' itemscope itemtype="http://schema.org/Organization">
|
||||||
<meta itemprop='name' content='<%= SiteSetting.company_name.presence || SiteSetting.title %>'>
|
<meta itemprop='name' content='<%= SiteSetting.company_name.presence || SiteSetting.title %>'>
|
||||||
|
|
|
@ -59,5 +59,6 @@ RSpec.describe "topics/show.html.erb" do
|
||||||
topic_schema = doc.css('[itemtype="http://schema.org/DiscussionForumPosting"]')
|
topic_schema = doc.css('[itemtype="http://schema.org/DiscussionForumPosting"]')
|
||||||
expect(topic_schema.size).to eq(1)
|
expect(topic_schema.size).to eq(1)
|
||||||
expect(topic_schema.css('[itemtype="http://schema.org/Comment"]').size).to eq(2)
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue