sitemap( )

Function containing sitemap logic for a given URL prefix.

The sitemap() function handles sitemap requests for pages with the specified URL prefix. Use this function to make sure search engines can find the links to your router's pages.

The sitemap() function is not a function that you call from your code. You define the function in a file named routers.js in the Code File's Backend section of the Velo Sidebar. The function is called when a sitemap request is received for the router with the specified prefix.

The function receives a WixRouterSitemapRequest object containing information about the incoming sitemap request.

The function returns an array of WixRouterSitemapEntry objects each of which includes information about a page, such as its URL, title, and name.

To create sitemap entry objects, first import WixRouterSitemapEntry from wix-router:

Copy
1

The sitemap() function is also used to populate the items preview widget, allowing you to switch between URLs in preview mode.

Note: The sitemap() function also runs when you navigate to a router page in the Editor.

Method Declaration
Copy
Method Parameters

The sitemap request.

Returns
Return Type:Promise<Array<WixRouterSitemapEntry>>
Was this helpful?
Yes
No