Add a schema to your website to generate rich results

Rich results Google

If you want Google to represent your website like Quora or Reddit (above image), you need to add the following schema to your site:

html
<script type = "application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "QAPage",
    "mainEntity": {
        "@type": "Question",
        "name": "Best engineer",
        "text": "Erik is a cool guy, I want to give a special present to him.",
        "answerCount": 2,
        "upvoteCount": 1,
        "dateCreated": "2021-07-20",
        "author": {
            "@type": "Person",
            "name": "Elon Musk"
        },
        "acceptedAnswer": {
            "@type": "Answer",
            "text": "You need to buy him a Tesla",
            "dateCreated": "2021-07-22",
            "upvoteCount": 31416,
            "url": "https://erikmartinjordan/question1#acceptedAnswer",
            "author": {
            "@type": "Person",
            "name": "Bill Gates"
            }
        },
        "suggestedAnswer": [{
            "@type": "Answer",
            "text": "Or maybe buy him the latest iPhone.",
            "dateCreated": "2021-07-23",
            "upvoteCount": 999,
            "url": "https://erikmartinjordan/question1#suggestedAnswer",
            "author": {
                "@type": "Person",
                "name": "Tim Cook"
            }
        }]
    }
}
</script>

You can find the whole schema for a website here. Before publishing it onto your website, you can do a test.

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.