mirror of
https://github.com/discourse/discourse.git
synced 2025-06-13 01:46:29 +08:00
FEATURE: Add structured data to follow Google's guidelines (#9764)
All Schema.org properties are optional, but Google has a set of properties which are required.
This commit is contained in:
@ -36,9 +36,17 @@
|
|||||||
<%- if include_crawler_content? %>
|
<%- if include_crawler_content? %>
|
||||||
|
|
||||||
<% @topic_view.posts.each_with_index do |post, idx| %>
|
<% @topic_view.posts.each_with_index do |post, idx| %>
|
||||||
<div itemscope itemtype='http://schema.org/DiscussionForumPosting' class='topic-body crawler-post'>
|
<% if (u = post.user) %>
|
||||||
<% if (u = post.user) %>
|
<div itemscope itemtype='http://schema.org/DiscussionForumPosting' class='topic-body crawler-post'>
|
||||||
<div class='crawler-post-meta'>
|
<div class='crawler-post-meta'>
|
||||||
|
<div itemprop='publisher' itemscope itemtype="http://schema.org/Organization">
|
||||||
|
<meta itemprop='name' content='<%= SiteSetting.company_name.presence || SiteSetting.title %>'>
|
||||||
|
<% if application_logo_url.present? %>
|
||||||
|
<div itemprop='logo' itemscope itemtype="http://schema.org/ImageObject">
|
||||||
|
<meta itemprop='url' content='<%= application_logo_url %>'>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
<span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person">
|
<span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person">
|
||||||
<a itemprop="url" href='<%= Discourse.base_url %>/u/<%= u.username %>'><span itemprop='name'><%= u.username %></span></a>
|
<a itemprop="url" href='<%= Discourse.base_url %>/u/<%= u.username %>'><span itemprop='name'><%= u.username %></span></a>
|
||||||
<%= "(#{u.name})" if (SiteSetting.display_name_on_posts && SiteSetting.enable_names? && !u.name.blank?) %>
|
<%= "(#{u.name})" if (SiteSetting.display_name_on_posts && SiteSetting.enable_names? && !u.name.blank?) %>
|
||||||
@ -51,6 +59,8 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<link itemprop="mainEntityOfPage" href="<%= post.topic.url %>">
|
||||||
|
|
||||||
<% if post.image_url %>
|
<% if post.image_url %>
|
||||||
<link itemprop="image" href="<%= Discourse.base_url %><%= post.image_url %>">
|
<link itemprop="image" href="<%= Discourse.base_url %><%= post.image_url %>">
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -105,9 +115,8 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @topic_view.prev_page || @topic_view.next_page %>
|
<% if @topic_view.prev_page || @topic_view.next_page %>
|
||||||
|
Reference in New Issue
Block a user