Search.../

setStructuredData( )

Sets the page's structured data.

Description

The structured data on your page helps search engines understand more about your page and your business so they can display a richer snippet of your pages in search results.

The structured data you set overwrites any structured data information set earlier.

Note: You should always set the structured data inside the onReady() event handler to ensure search engines can read it.

Syntax

function setStructuredData(structuredData: Array<Object>): Promise<void>

setStructuredData Parameters

NAME
TYPE
DESCRIPTION
structuredData
Array<Object>

List of structured data objects in the JSON-LD format as defined by schema.org.

Returns

Fulfilled - When the structured data is set.

Return Type:

Promise<void>

Related Content:

Was this helpful?

Set a page's structured data

Copy Code
1import wixSeo from 'wix-seo';
2
3// ...
4
5$w.onReady( () => {
6 wixSeo.setStructuredData(
7 [
8 {
9 "@context": "http://schema.org",
10 "@type": "Organization",
11 "name": "My Organization Name",
12 "url": "https://www.myorgdomain.com"
13 },
14 {
15 "@context": "http://schema.org",
16 "@type": "Person",
17 "email": "mailto:john.doe@somedomain.com",
18 "jobTitle": "Professor",
19 "name": "John Doe",
20 "telephone": "(555) 555-555"
21 }
22 ]
23 )
24 .then( () => {
25 console.log("structured data set");
26 } )
27 .catch( () => {
28 console.log("failed setting structured data");
29 } );
30} );