Introduction

To use the SEO API, import wixSeoFrontend from the wix-seo-frontend module:

Copy
import wixSeoFrontend from "wix-seo-frontend";
Did this help?


metaTags


metaTagsArray<MetaTag>Read-only

Gets the page's SEO-related meta tags.

The metaTags property retrieves the SEO-related meta tags from the head of the page.

The keys in the returned metaTags objects represent the keys in the tag, while the values in the object represent the values in the tag.

For example:

{ "property": "og:image", "content": "https://.../Wix+logo.jpg" }

Produces:

Note: You should always invoke the wixSeoFrontend.metaTags getter outside of the onReady() event handler to ensure receiving the proper response.

Get a page's meta tags
JavaScript
import wixSeoFrontend from "wix-seo-frontend"; // ... let metaTags = wixSeoFrontend.metaTags; /* metaTags: * * [ * { * "name": "robots", * "content": "noindex" * }, { * "property": "og:image", * "content": "wix:image://v1/6...2.jpg/a.jpg#originWidth=970&originHeight=120" * } * ] */
Did this help?

structuredData


structuredDataArray<object>Read-only

Gets 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.

Set the structured data with a list of structured data objects in the JSON-LD format as defined by schema.org.

Note: You should always invoke the wixSeoFrontend.structuredData getter outside of the onReady() event handler to ensure receiving the proper response.

Get a page's structured data
JavaScript
import wixSeoFrontend from "wix-seo-frontend"; // ... let structuredData = wixSeoFrontend.structuredData; /* structuredData: * * [ * { * "@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" * } * ] */
Did this help?

title


titlestringRead-only

Gets the page's title.

The title is an important factor that lets search engines determine the topic of a page.

Note: You should always invoke the wixSeoFrontend.title getter outside of the onReady() event handler to ensure receiving the proper response.

Get the SEO title
JavaScript
import wixSeoFrontend from "wix-seo-frontend"; // ... let title = wixSeoFrontend.title; // "Page Title"
Did this help?


setMetaTags( )


Sets the page's SEO-related meta tags.

The setMetaTags() function creates SEO-related meta tags in the head of the page.

The keys in the specified metaTags objects represent the keys in the tag, while the values in the metaTags object represent the values in the tag.

For example:

Copy
{ "property": "og:image", "content": "https://.../Wix+logo.jpg" }

Produces:

When setting og:image meta tags, the content can be and external image URL or a Media Manager image URL as described here.

The meta tags you set overwrite any meta tag information set earlier.

Notes:

  • Do not use setMetaTags() to create tags for the title. Use the setTitle() function instead.

  • You should always set the metaTags inside the onReady() event handler to ensure search engines can read it.

Method Declaration
Copy
function setMetaTags(metaTags: Array<MetaTag>): Promise<void>;
Method Parameters
metaTagsArray<MetaTag>Required

The meta tags to set.

Set a page's meta tags
JavaScript
import wixSeoFrontend from "wix-seo-frontend"; // ... $w.onReady(() => { wixSeoFrontend .setMetaTags([ { name: "robots", content: "noindex", }, { property: "og:image", content: "wix:image://v1/6...2.jpg/a.jpg#originWidth=970&originHeight=120", }, ]) .then(() => { console.log("meta tags set"); }) .catch(() => { console.log("failed setting meta tags"); }); });
Did this help?

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 wixSeoFrontend from "wix-seo-frontend"; // ... $w.onReady(() => { wixSeoFrontend .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", }, ]) .then(() => { console.log("structured data set"); }) .catch(() => { console.log("failed setting structured data"); }); });
Did this help?

setTitle( )


Sets the page's title.

Setting a proper title is important to let search engines determine the topic of your page.

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

Method Declaration
Copy
function setTitle(title: string): Promise<void>;
Method Parameters
titlestringRequired

The title to set.

Set a page's SEO title
JavaScript
import wixSeoFrontend from "wix-seo-frontend"; // ... $w.onReady(() => { wixSeoFrontend .setTitle("New Title") .then(() => { console.log("title set"); }) .catch(() => { console.log("failed setting title"); }); });
Did this help?