Skip to content

Commit

Permalink
FIX: make JSON_LD schema consistent with our microdata in core
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitjalan committed Nov 21, 2023
1 parent bc9b8c4 commit 820163d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,11 @@ def before_head_close_meta(controller)
"text" => get_schema_text(first_post),
"upvoteCount" => first_post.like_count,
"answerCount" => 0,
"dateCreated" => topic.created_at,
"datePublished" => topic.created_at,
"author" => {
"@type" => "Person",
"name" => topic.user&.name,
"username" => topic.user&.username,
"url" => topic.user&.full_url
},
}

Expand All @@ -319,11 +320,12 @@ def before_head_close_meta(controller)
"@type" => "Answer",
"text" => get_schema_text(accepted_answer),
"upvoteCount" => accepted_answer.like_count,
"dateCreated" => accepted_answer.created_at,
"datePublished" => accepted_answer.created_at,
"url" => accepted_answer.full_url,
"author" => {
"@type" => "Person",
"name" => accepted_answer.user&.username,
"url" => accepted_answer.user&.full_url
},
}
else
Expand Down

0 comments on commit 820163d

Please sign in to comment.