mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 23:07:28 +08:00
FIX: Restore author on non-first-post crawler views (#26459)
Followup to 3329484e2d64951956981bde9bff662d6ad8b412
This commit is contained in:
@ -51,7 +51,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if @topic_view.posts&.first && !@topic_view.posts.first.is_first_post? %>
|
<% if @topic_view.crawler_posts&.first && !@topic_view.crawler_posts.first.is_first_post? %>
|
||||||
<span itemprop='author' itemscope itemtype="http://schema.org/Person">
|
<span itemprop='author' itemscope itemtype="http://schema.org/Person">
|
||||||
<meta itemprop='name' content='<%= @topic_view.topic.user.username %>'>
|
<meta itemprop='name' content='<%= @topic_view.topic.user.username %>'>
|
||||||
<link itemprop='url' href='<%= Discourse.base_url %>/u/<%= @topic_view.topic.user.username %>'>
|
<link itemprop='url' href='<%= Discourse.base_url %>/u/<%= @topic_view.topic.user.username %>'>
|
||||||
|
@ -5261,6 +5261,23 @@ RSpec.describe TopicsController do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "includes top-level author metadata when the view does not include the OP naturally" do
|
||||||
|
get "#{topic.relative_url}/2"
|
||||||
|
expect(body).to have_tag(
|
||||||
|
"[itemtype='http://schema.org/DiscussionForumPosting'] > [itemprop='author']",
|
||||||
|
)
|
||||||
|
|
||||||
|
get "#{topic.relative_url}/27"
|
||||||
|
expect(body).to have_tag(
|
||||||
|
"[itemtype='http://schema.org/DiscussionForumPosting'] > [itemprop='author']",
|
||||||
|
)
|
||||||
|
|
||||||
|
get "#{topic.relative_url}?page=2"
|
||||||
|
expect(body).to have_tag(
|
||||||
|
"[itemtype='http://schema.org/DiscussionForumPosting'] > [itemprop='author']",
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
context "with canonical_url" do
|
context "with canonical_url" do
|
||||||
fab!(:topic_embed) { Fabricate(:topic_embed, embed_url: "https://markvanlan.com") }
|
fab!(:topic_embed) { Fabricate(:topic_embed, embed_url: "https://markvanlan.com") }
|
||||||
let!(:user_agent) do
|
let!(:user_agent) do
|
||||||
|
Reference in New Issue
Block a user