mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 05:13:39 +08:00
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? %>
|
||||
<div itemscope itemtype='http://schema.org/DiscussionForumPosting'>
|
||||
<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(', ') %>'>
|
||||
<div itemprop='publisher' itemscope itemtype="http://schema.org/Organization">
|
||||
<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"]')
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user