setStructuredData( )


Sets the page's structured data.

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.

Method Declaration
Copy
function setStructuredData(structuredData: Array<object>): Promise<void>;
Method Parameters
structuredDataArray<object>Required

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

Set a page's structured data
JavaScript
import { createClient } from "@wix/sdk"; import { site } from "@wix/site"; import { seo } from "@wix/site-seo"; const wixClient = createClient({ host: site.host(), modules: { seo }, }); // ... document.addEventListener("DOMContentLoaded", async () => { try { await wixClient.seo.setStructuredData([ { "@context": "http://schema.org", "@type": "Organization", name: "My Organization Name", url: "https://www.myorgdomain.com", }, { "@context": "http://schema.org", "@type": "Person", email: "mailto:john.doe@somedomain.com", jobTitle: "Professor", name: "John Doe", telephone: "(555) 555-555", }, ]); console.log("structured data set"); } catch { console.log("failed setting structured data"); } });
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?