Hot answers tagged

32

The @id keyword allows you to give a node a URI. This URI identifies the node. See Node Identifiers in the JSON-LD spec. (The equivalent in Microdata is the itemid attribute, and the equivalent in RDFa Lite is the resource attribute.) Why are identifiers useful? You can reference a node instead of repeating it (see my example). Other authors can do the ...


14

The script element can be used for two things: dynamic/classic scripts data And for data, the spec defines: When used to include data blocks, the data must be embedded inline […] So you may use the src attribute only for scripts, not for data. → As JSON-LD is data, you have to inline it. While linking a JSON-LD file is possible with the link element, ...


13

The document that recommends JSON-LD is more recent and it clearly states that Google recommends using JSON-LD where possible (over Microdata) specifically for the following reasons: "The markup does not have to be interleaved with the user-visible text, which makes nested data items easier to express, such as the Country of a PostalAddress of a MusicVenue ...


12

Similar to adding multiple string/URL values: by using an array. <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "Organization", "address": [ { "@type": "PostalAddress" }, { "@type": "PostalAddress" } ] } </script>


9

Tool from Yandex The "Structured data validator" supports JSON-LD. Alexander Shubin (working for Yandex) wrote: Pls, take into account that in order to check JSON-LD you need to put it in tag (since this is how it should be embedded into html). E.g., <script type="application/ld+json">{ "@context":"http://schema.org", "@type" : "...


8

JSON-LD doesn’t care. Which makes sense, because the data is the same, no matter from where in the document it gets extracted. From the perspective of HTML, you should only include it in the head if the JSON-LD is about your web page or about what your web page represents, because the head element is defined to contain metadata for the document. But it’s ...


8

Reading the following link from Google Developers - Data types - Local Business in the Local business properties section you have: [...] The ID should be stable and unchanging over time. Google Search treats the URL as an opaque string and it does not have to be a working link. If the business has multiple locations, make sure the @id is unique for each ...


7

In JSON-LD (instead of Microdata/RDFa) you have to repeat the property and its value for each node. Instead of using a separate script element for each node, you could also use a single script element that contains all your nodes as value of @graph. That way you only have to define the @context (and possibly custom properties) one time. <script type="...


7

your code contains error, thats why two authors aren't recognized. If you have more then one author, you should add them as list without entity duplication. Here the correct code: <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "WebPage", "mainEntity": { "@type": "Book", "author": [{ ...


7

A quick point on this. A site I work on recently got a manual action penalty from Google for having organization JSON-LD markup across every single page on their domain. It didn't affect rankings of course but would have impacted all other structured data until resolved. It's one of the minor pitfalls of JSON-LD; that you can put it anywhere and if Google ...


7

It should be fine to use different syntaxes on the same page. It has one drawback, though: If you want to connect entities specified in different syntaxes, you can’t nest them. You have to use URIs instead. (But note that not necessarily all consumers of the data follow such URI references.) Example showing nesting vs. referencing You can connect a ...


6

I assume you mean two Offer items for one Product (like your example suggests). Instead of repeating the offers property, you have to use one offers property with an array value (in [ and ]): "offers": [ { "@type": "Offer" }, { "@type": "Offer" } ]


5

Google looks for such information in traditional places such as About, Contact, Company Info, the sites header, or the sites footer. This began in the early days of semantics where specific information from any website was collected to better help match search intent with entities, locale, and persons. The home page is a good place for this, but is not ...


5

Update 2016: The documentation got updated and it no longer contains the note. So now JSON-LD seems to be supported for the Products Rich Snippet. Google’s documentation for the Products Rich Snippet says for the single product page: We are in the process of implementing JSON-LD support for this Rich Snippet type. At the current time, we recommend using ...


5

See Google documentation: https://developers.google.com/search/docs/data-types/articles Images should be at least 696 pixels wide. So this one works for me: <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "NewsArticle", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://google.com/article" }, ...


5

When adding exception operations, there's a note above it: Fire this trigger when an Event occurs and all of these conditions are true You'll need to create two separate rules, each containing just onePage URL operation. Then add both rules to the list of exceptions.


5

If you want to provide multiple addresses, you have to specify one address property with an array value, not an array of address properties. If you click at the error in the SDTT, the tool correctly highlights the line where the error begins (line 7, i.e., the opening [).


5

First of all, for the image property, Schema.org expects either an URL value or an ImageObject value. This is typically the case for other properties taking an image value, too. So for the image property, you could as well use: <div itemscope itemtype="http://schema.org/Thing"> <img itemprop="image" src="image.png" alt="" /> </div> So ...


5

If you provide structured data about the same thing in different syntaxes, you should convey that it’s actually the same thing, not different things. You can do this by giving all representations the same URI. JSON-LD: @id Microdata: itemid RDFa: resource / about <!-- JSON-LD --> <script type="application/ld+json"> { "@context": "http://...


5

You need to add speech marks (") around the URL's you have in that list. Your last URL in the list also can't have a comma after it. I have placed the corrected code below. { "@context" : "http://schema.org", "@type" : "Organization", "name" : "Motorfix Wangara", "url" : "https://www.motorfix.com.au", "sameAs" : [ "https://...


4

Yes, you can. The first script indicates the URL of internal site search to be shown in Google SERP between your main entry and sitelinks. The second script indicates your social media accounts to be shown in the Knowledge Graph. The scripts don't boost your rankings, they just give Google clues about what to include in the SERP if your site is strong enough ...


4

I guess there is no reason to assume that Google wouldn’t handle SVGs as value of the image property: Schema.org’s image property expects an image URL (or an ImageObject). SVG is an image format (image/svg+xml). Google does index SVG images. (Of course, we can never be sure; and things might change always.) Generally, the syntax shouldn’t matter, as long ...


4

According to the documentation: […] Also, Google can read JSON-LD data when it is dynamically injected into the page's contents, such as by JavaScript code or embedded widgets in your content management system. Which suggests that, while yo cannot link external json-ld data, you can still load it dynamically and inject it to the DOM. This might be good ...


4

You have several options: as top-level items (only use this if the other two options are not possible) as values for a property (best option, but requires that Schema.org offers a suitable type/property for your case) as ItemList (second-best option; requires that it makes sense to group them) As top-level items If you want to provide the Person items as ...


4

The height and width properties expect either a Distance or a QuantitativeValue value. Both of your corresponding examples are correct: Distance value: "width": "100 px" QuantitativeValue value (E37 is the UN/CEFACT Common Code for "pixel"): "width": { "@type": "QuantitativeValue", "unitCode": "E37", "value": "100" } For a consumer that ...


4

Semantic Web The W3C provides Semantic Web logos. Here are the versions without the W3C logo: (usage guidelines) But in my experience, these logos are used to represent the concept, they don’t necessarily signal that structured data is available for that page. RDF For signaling that RDF is available, W3C’s RDF icons are commonly used. Here is the version ...


4

Google uses the phrase "Include the contact markup on one page in your official site" in relation to the Organization information you are adding. https://developers.google.com/search/docs/guides/enhance-site Typically you would add it to the home page or contact page. i.e. pages that talk about the organization. Don't add it to pages on other subjects ...


4

<script src="https://example.site.com/rich-snippet/dist.js" defer=""></script> <script> window.addEventListener('load', function() { richSnippet(); }); </script> Removing the ES6 syntax seems to resolve the issue, I think due the context of the event that would be passed. Stephen Ostermiller: Why would you add ...


3

Not looking to be a necromancer, but there was a recent article from someone at Yoast that details problems that arise with using the @Graph type when trying to get Google search to "report" the subsequent types, especially with Organization data: link I would recommend breaking out each type into its own "node" for now instead of using @graph as an array, ...


3

The author Your description seems to be about the person, not the page. And for creator, you would ideally provide a Person value (which then also allows you to add the description there). However, the blog post author is not really the author of this page. Either omit the creator on this level and add it to each blog post, and/or (I’m not 100 % sure if ...


Only top voted, non community-wiki answers of a minimum length are eligible