Structured Data - JSON-LD
Structured Data is hard when you're starting out. Conflicting info. Old outdated information. Poor documentation. I've spent a significant amout of time trying to master it. Now you can benefit from all my hard work and testing. Everything here works properly or it wouldn't be here. Many of these will provide the fancy Google Search Enhancements you desire and ensure your content types are marked up properly.
Structured Data News
Aug 15th 2022 (View)
Google has added a clarification in its product structured data documentation around GTIN usage. Read more!
Dec 15th 2020 (View)
Google provides an update on their Structured Data Testing Tool's future. (Saved!) Read more!
May 25th 2020 (View)
Tony McCreath has created a very cool tool to visualize structured data at any given URL. Simply enter a URL by clicking the "Fetch from URL" button and behold. Try it out!
Apr 6th 2020 (View)
Google has released documentation to guide the implementation of structured data via JavaScript, whether by using Google Tag Manager with JSON-LD or custom JS. Read more.
Sept 13th 2019 (View)
Google's John Mueller clarified on the September 11 edition of #AskGoogleWebmasters that JSON structured data can be inserted in the head as well as the body of your pages. Read more.
Apr 16th 2019 (View)
Yoast adds drastically enhanced Structured Data support to Wordpress with their latest version of their plugin. Read more.
Feb 25th 2019 (View)
Another uproar hits the web after SEJ posts that Google has declared Structured Data shouldn't be inserted via Google Tag Manager. While it's tough to argue against such a reputable source, I'd like to point out that one important quote was omitted in the article from the discussion. "While you can use GTM to add SD to pages, and some people do, it's more complex and brittle." The article also pointed to the fact that the Structured Data testing tool can't see SD that's been inserted onto a page by GTM as proof that it's not meant to be done. But this is a fairly well known issue that is worked around by inserting it via Javascript (See below). I've asked @JohnMu to elaborate or affirm but he never seems to address these challenging questions directly. Or he's cryptic about it. John is always cited as the guy who is saying GTM insertion shouldn't be done, but he's also a guy who knows that it can be done successfully.
Jul 13th 2018 (View)
Google's Structured Data Testing Tool has stopped seeing Structured Data thats been inserted via Google Tag Manager. This caused a minor little uproar on Twitter when Google's John Mueller tweeted a response of "I wouldn't rely on a tool like GTM to add Structured Data". One blog immediately twisted this into wrote that Google itself has now declared that GTM should not be used for inserting Structured Data. Which is ridiculous. A new way to insert Structured Data via Google Tag Manager has been found by Simo Ahava and this method allows for the testing tool to detect the Structured Data 100% fine. This tool by Saijo George can help you generate the Google Tag Manager friendly version of your JSON-LD code.
Primer
Total newb to all this? See this great beginner's guide on Moz
Installation
A.) Hand code it in (Learn more)
Ugh! This is not easily maintainable at scale.
Although the Structured Data CAN be placed in the head and work properly, Google's examples show it being placed in the body immediately after the opening body tag. Their CodeLab shows it in the head though.
Google's John Mueller clarified on the September 11 edition of #AskGoogleWebmasters that JSON structured data can be inserted in the head as well as the body of your pages. Read more
B.) Use Google Tag Manager (Learn more)
Use Google Tag Manager to insert the code with the "Custom HTML" tag. (See screenshot below.) Why Tag Manager? Because Tag Manager can dynamically change the Structured Data based on the content of the page! (eg: Blog posts) See this article and this older Moz article for more information on how to do that.
UPDATE: Google changed something. Now, in order to have the Structured Data Testing tool detect inserted Structured Data properly, it must be inserted programatically. Pasting your desired Structured Data within this snippet below will allow it to be detected properly by the testing tool.
<!-- GOOGLE TAG MANAGER VERSION -->
<!-- Credit: https://twitter.com/SimoAhava/status/1001397355403468802 -->
<!-- Source: https://github.com/JayHoltslander/Structured-Data-JSON-LD -->
<script>
(function() {
var jsonData =
// PASTE THE JSON THAT YOU WANT TO USE, HERE.
// Only paste what's within the <script> block.
// Your pasted content should start with a { and end with a }
; var el = document.createElement('script');
el.type = 'application/ld+json';
el.innerHTML = JSON.stringify(jsonData);
document.head.appendChild(el);
})();
</script>
See also:
 |
| 🔍 Screenshot |
C.) Use a Wordpress plugin (Learn more)
- https://yoast.com/schema-org-is-hard-were-making-it-easy/
- https://wpschema.com/schema-types/
Contents
An average rating based on multiple ratings or reviews utilizing the AggregateRating schema. Be sure to read this article to see why using this example as written might not be the best idea. Hmm. 🤔 Also note that using a 3rd party's ratings (like say Google or Yelp) for a localBusiness seems to go against Google's guidelines. BUT, also see this note on using 3rd party reviews.
If you’re a publisher website, the more specific schema types like NewsArticle or BlogPosting are recommended (choose one or the other, depending on your site/content). Leveraging these markups accordingly can help your content to appear in Google News and in-depth articles search suggestions. See: Enabling Rich Snippets for Articles. Note: To show up in Google's News Carousel not only will the page require Structured Data but it's also required to be a valid AMP page. If you are using the official AMP Plugin for Wordpress you will definitely want to use Tag Manager to insert your Structured Data as opposed to other methods since you will be able to dynamically generate Schema.org JSON-LD Tags from pages that contain the correct pattern for your posts. eg: ?amp=1 or /amp