Search code examples
gmailjson-ld

How I can I make my articles show the "View article" preview on Google Inbox?


I've setup my site to show previews on Facebook, Twitter Cards and other services using OpenGraph, but I'm wondering what is necessary to make my articles show a "Go to action" on Inbox when they're shared?

Article preview


Solution

  • You'll need to add the Gmail > Markup > View Action markup to your content.

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "EmailMessage",
      "potentialAction": {
        "@type": "ViewAction",
        "target": "https://watch-movies.com/watch?movieId=abc123",
        "name": "Watch movie"
      },
      "description": "Watch the 'Avengers' movie online"
    }
    </script>