routerSitemap( )


Returns the sitemap for a router or dynamic page prefix.

The routerSitemap() function returns a Promise that resolves to a list of WixSitemapEntry objects. Each WixSitemapEntry includes information about a page, such as its URL, title, and name.

A sitemap is used by search engines to find the links to the site's pages.

Method Declaration
Copy
function routerSitemap(
  routerPrefix: string,
): Promise<Array<WixRouterSitemapEntry>>;
Method Parameters
routerPrefixstringRequired

The prefix of the router to get the sitemap for.

Returns
Return Type:Promise<Array<WixRouterSitemapEntry>>
Get the sitemap for a prefix
JavaScript
import wixSiteFrontend from "wix-site-frontend"; // ... wixSiteFrontend.routerSitemap("routerPrefix").then((routerSitemap) => { const sitemap = routerSitemap; }); /* * sitemap: * * [ * { * "url": "Ash", * "lastModified": null, * "changeFrequency": "", * "priority": null, * "title": "Ash Stowe", * "pageName": "Ash's Page" * }, * { * "url": "Aiden", * "lastModified": null, * "changeFrequency": "", * "priority": null, * "title": "Aiden Johnson", * "pageName": "Aiden's page" * }, * { * "url": "Jess", * "lastModified": null, * "changeFrequency": "", * "priority": null, * "title": "Jess White", * "pageName": "Jess's page" * }, * { * "url": "Morgan", * "lastModified": null, * "changeFrequency": "", * "priority": null, * "title": "Morgan James", * "pageName": "Morgan's Page" * } * ] */
Errors

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

Did this help?