FIX: Ensure consistent `datePublished` on follow-up pages in topic microdata schema (#25130)

* Ensure consistent `datePublished` and remove `text` on second page in topic microdata schema

Always use `datePublished` from topic and never from `first_psot`. This ensures `datePublished` to be consistent on `first page` and `page=2+`.

No need to repeat `text` on `page=2+`. Especially do not set `text` on `page=2+` if it is only an abstract and thereby not 100% consistent with `text` on `first page`.

* Keep `text`attribute on follow-up pages
This commit is contained in:
Ayke Halder 2024-01-12 07:41:08 +01:00 committed by GitHub
parent c76ca876a6
commit 16b8476cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -37,6 +37,7 @@
<div itemscope itemtype='http://schema.org/DiscussionForumPosting'>
<meta itemprop='headline' content='<%= @topic_view.title %>'>
<link itemprop='url' href='<%= @topic_view.absolute_url %>'>
<meta itemprop='datePublished' content='<%= @topic_view.topic.created_at.to_formatted_s(:iso8601) %>'>
<% if @topic_view.topic.category.present? %>
<meta itemprop='articleSection' content='<%= @topic_view.topic.category.name %>'>
<% end %>
@ -51,7 +52,6 @@
</div>
<% if @topic_view.prev_page %>
<meta itemprop='datePublished' content='<%= @topic_view.topic.created_at.to_formatted_s(:iso8601) %>'>
<span itemprop='author' itemscope itemtype="http://schema.org/Person">
<meta itemprop='name' content='<%= @topic_view.topic.user.username %>'>
<link itemprop='url' href='<%= Discourse.base_url %>/u/<%= @topic_view.topic.user.username %>'>
@ -85,7 +85,7 @@
<% end %>
<span class="crawler-post-infos">
<time itemprop='datePublished' datetime='<%= post.created_at.to_formatted_s(:iso8601) %>' class='post-time'>
<time <%= post.is_first_post? ? "" : "itemprop='datePublished'".html_safe %> datetime='<%= post.created_at.to_formatted_s(:iso8601) %>' class='post-time'>
<%= l post.created_at, format: :long %>
</time>
<% if post.version > 1 %>