FIX: improve structured data based on recent changes (#25043)

This commit makes some improvements to a topic's structured data based
on the recommendation on meta topic: https://meta.discourse.org/t/google-structured-data-for-forums-and-profile-pages/286762/9
This commit is contained in:
Arpit Jalan 2023-12-27 11:13:16 +05:30 committed by GitHub
parent 596ba54302
commit d9ca6c3bb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,7 @@
<%- if include_crawler_content? %>
<div itemscope itemtype='http://schema.org/DiscussionForumPosting'>
<meta itemprop='headline' content='<%= @topic_view.title %>'>
<meta itemprop='url' content='<%= @topic_view.absolute_url %>'>
<% if @topic_view.topic.category.present? %>
<meta itemprop='articleSection' content='<%= @topic_view.topic.category.name %>'>
<% end %>
@ -66,7 +67,7 @@
<% end %>
</span>
<link itemprop="mainEntityOfPage" href="<%= post.topic.url %>">
<link <%= post.is_first_post? ? "itemprop='mainEntityOfPage'" : "" %> href="<%= post.topic.url %>">
<% if post.image_url %>
<link itemprop="image" href="<%= post.image_url %>">
@ -84,7 +85,7 @@
<span itemprop='position'><%= post.post_number %></span>
</span>
</div>
<div class='post' itemprop='<%= post.is_first_post? ? 'articleBody' : 'text' %>'>
<div class='post' itemprop='text'>
<%= post.hidden ? t('flagging.user_must_edit').html_safe : post.cooked.html_safe %>
</div>