Merge remote-tracking branch 'notriddle/master'

This commit is contained in:
Vinoth Kannan 2019-01-16 00:21:51 +05:30
commit f8150b496e
1 changed files with 3 additions and 8 deletions

View File

@ -246,10 +246,6 @@ SQL
} }
} }
page_json = {
'@type' => 'QAPage',
'name' => topic&.title,
}
if accepted_answer = Post.find_by(id: topic.custom_fields["accepted_answer_post_id"]) if accepted_answer = Post.find_by(id: topic.custom_fields["accepted_answer_post_id"])
question_json[:acceptedAnswer] = { question_json[:acceptedAnswer] = {
'@type' => 'Answer', '@type' => 'Answer',
@ -266,10 +262,9 @@ SQL
['<script type="application/ld+json">', MultiJson.dump( ['<script type="application/ld+json">', MultiJson.dump(
'@context' => 'http://schema.org', '@context' => 'http://schema.org',
'@graph' => [ '@type' => 'QAPage',
page_json, 'name' => topic&.title,
question_json, 'mainEntity' => question_json
]
).gsub("</", "<\\/").html_safe, '</script>'].join("") ).gsub("</", "<\\/").html_safe, '</script>'].join("")
end end