Support schema.org QAPage and Google rich results

This was already implemented in the discourse-solved plugin (PR by @notriddle). If you view this topic as googlebot, you will find this in the head:

<script type="application/ld+json">
{
  "@context": "http:\/\/schema.org",
  "@graph": [
    {
      "@type": "QAPage",
      "name": "Limit consecutive replies for topic owner?"
    },
    {
      "@type": "Question",
      "name": "Limit consecutive replies for topic owner?",
      "text": "Hi, \nI can see that the Limit Consecutive Replies is set to 3 and it does make sense in general but in our community, some users have started small personal \u201cBlogs\u201d in our Book o Remembrance.  the creator is generally speaking the only one posting.  These users are now  limited to 3 posts \nIs this  &hellip;",
      "upvoteCount": 2,
      "answerCount": 3,
      "dateCreated": "2018-12-03T22:44:18.304Z",
      "author": {
        "@type": "Person",
        "name": ""
      },
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes! Agreed, we ran into this situation early on and added a new rule that \n\nif you created the topic\nyou can reply as many times as you like to it\n\n<a class=\"mention\" href=\"\/u\/nbianca\">@nbianca<\/a> made this change today or yesterday it is already in, so pull latest to get it.",
        "upvoteCount": 9,
        "dateCreated": "2018-12-04T02:36:30.988Z",
        "url": "https:\/\/meta.discourse.org\/t\/limit-consecutive-replies-for-topic-owner\/103405\/2",
        "author": {
          "@type": "Person",
          "name": "codinghorror"
        }
      }
    }
  ]
}
</script>

And in google’s results tester:

It looks like we have some errors in the implementation though… google’s testing tool reports issues, and the escaping of backslashes looks all wrong.

13 Likes