CodeAPI

WixRouterSitemapRequest

An object representing a request for a sitemap.

Table of Contents

PROPERTIES

?
Store values associated with an object.
baseUrlReturns the base URL of the request.
pageNameSets or gets the page name.
pagesReturns the names of the pages associated with this router.
prefixReturns the router prefix of the request.
userReturns the details of the current site user who is logged in.

baseUrl

Returns the base URL of the request.

Description

Premium sites:

Free sites:

Syntax

get baseUrl(): string
TYPE
?
The kind of data the property stores.
string

Examples

Get the base URL of the request

export function myRouter_SiteMap(sitemapRequest) {

  let baseUrl = sitemapRequest.baseUrl;
  // Premium site: "https://domain.com"
  // Free site: "https://user.wix-sites.com/zoo"

}

pageName

Sets or gets the page name.

Syntax

get pageName(): string
TYPE
?
The kind of data the property stores.
string

Examples

Get the request's page name

export function myRouter_SiteMap(sitemapRequest) {

  let pageName = sitemapRequest.pageName; // "Page Name"

}

pages

Returns the names of the pages associated with this router.

Description

Pages are added and removed from a router in the Editor.

Syntax

get pages(): Array<string>
TYPE
?
The kind of data the property stores.
Array<string>

Examples

Get the names of the pages associated with this router

export function myRouter_SiteMap(sitemapRequest) {

  let pages = sitemapRequest.pages;
  // ["myRouter-page1", "myRouter-page2"]

}

prefix

Returns the router prefix of the request.

Description

Premium sites:

Free sites:

Syntax

get prefix(): string
TYPE
?
The kind of data the property stores.
string

Examples

Get the prefix of the request's URL

export function myRouter_SiteMap(sitemapRequest) {

  let prefix = sitemapRequest.prefix; // "animals"

}

user

Returns the details of the current site user who is logged in.

Description

Returns an object with the id and role of the logged in user who made the request.

Syntax

get user(): WixRouterUser

Examples

Get the user from the request

export function myRouter_SiteMap(sitemapRequest) {

  let user = sitemapRequest.user;
  /*
  * {
  *   "id": "f6q0fb32-b06r-469f-ag4d-9df89afkj5d9",
  *   "role": "Admin"
  * }
  */

}