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 { 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.setTitle("New Title"); console.log("title set"); } catch { console.log("failed setting title"); } });
Errors

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

Did this help?