0

I want to add Google structure data in WordPress Blog posts, pages. Where i need to place Structure data (in body or head section)? What is the correct schema structure for Posts or pages?

Thanks

migrated from wordpress.stackexchange.com Feb 6 at 19:13

This question came from our site for WordPress developers and administrators.

1

From the Google Codelabs:

Structured data provides a way to standardize information about a page and classify the page content. JSON-LD is used for data in a simple JavaScript-oriented object notation and is Google's preferred format for structured data. JSON-LD should be inside a element in either the or of the page.

There are some examples of how to implement it as part of the Codelab guide Add structured data to your web pages.

As to what data you use, it depends what your website posts and pages are about. There are many different schemas depending on the content, you can browse them on the https://schema.org website, along with JSON-LD example code. For example, if your posts are reviews for a book:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "WebPage",
  "breadcrumb": "Books > Literature & Fiction > Classics",
  "mainEntity":{
          "@type": "Book",
          "author": "/author/jd_salinger.html",
          "bookFormat": "http://schema.org/Paperback",
          "datePublished": "1991-05-01",
          "image": "catcher-in-the-rye-book-cover.jpg",
          "inLanguage": "English",
          "isbn": "0316769487",
          "name": "The Catcher in the Rye",
          "numberOfPages": "224",
          "offers": {
            "@type": "Offer",
            "availability": "http://schema.org/InStock",
            "price": "6.99",
            "priceCurrency": "USD"
          },
          "publisher": "Little, Brown, and Company",
          "aggregateRating": {
            "@type": "AggregateRating",
            "ratingValue": "4",
            "reviewCount": "3077"
          },
          "review": [
            {
              "@type": "Review",
              "author": "John Doe",
              "datePublished": "2006-05-04",
              "name": "A masterpiece of literature",
              "reviewBody": "I really enjoyed this book. It captures the essential challenge people face as they try make sense of their lives and grow to adulthood.",
              "reviewRating": {
            "@type": "Rating",
            "ratingValue": "5"
           }
            },
            {
              "@type": "Review",
              "author": "Bob Smith",
              "datePublished": "2006-06-15",
              "name": "A good read.",
              "reviewBody": "Catcher in the Rye is a fun book. It's a good book to read.",
              "reviewRating": "4"
            }
          ]
        }
}
</script>

You would probably want to use a hook to insert the script into the head of your site, pulling in data from your page/post.

0

All In One Schema Rich Snippets

This plugin will help you link

  • I don't want to use any plugin. – Shoaib Saleem Jan 30 at 12:11

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.