FIX: Always show the creation date of posts in crawler view (#14269)

The modification date should always be a meta tag to make this less confusing. Especially for imported posts.
That's more in line with how the rest of Discourse presents post dates.
This commit is contained in:
Gerhard Schlager 2021-09-08 11:03:55 +02:00 committed by GitHub
parent 5de64b3630
commit 8e60bce903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,16 +66,13 @@
<% end %>
<span class="crawler-post-infos">
<% if post.updated_at > post.created_at %>
<meta itemprop='datePublished' content='<%= post.created_at.to_formatted_s(:iso8601) %>'>
<time itemprop='dateModified' datetime='<%= post.updated_at.to_formatted_s(:iso8601) %>' class='post-time'>
<%= l post.updated_at, format: :long %>
</time>
<% else %>
<time itemprop='datePublished' datetime='<%= post.created_at.to_formatted_s(:iso8601) %>' class='post-time'>
<%= l post.created_at, format: :long %>
</time>
<meta itemprop='dateModified' content='<%= post.updated_at.to_formatted_s(:iso8601) %>'>
<% if post.version > 1 %>
<meta itemprop='dateModified' content='<%= post.last_version_at.to_formatted_s(:iso8601) %>'>
<% else %>
<meta itemprop='dateModified' content='<%= post.created_at.to_formatted_s(:iso8601) %>'>
<% end %>
<span itemprop='position'>#<%= post.post_number %></span>
</span>