wix-site

wix-site

The wix-site module contains functionality for obtaining information about your site and its pages.

To use the site module, import wixSite from the wix-site module:

ICAgaW1wb3J0IHdpeFNpdGUgZnJvbSAnd2l4LXNpdGUnOw==
   import wixSite from 'wix-site';

The APIs in wix-site can only be used in front-end code.

Contents

getSiteStructure( ) Returns information about the site's pages, prefixes, and lightboxes.
routerSitemap( ) Returns the sitemap for a router or dynamic page prefix.
Prefix An object that contains information about the site's prefixes.
SiteStructure An object that contains information about the site's pages, prefixes, and lightboxes.
StructureLightbox An object that contains information about a lightbox on the site.
StructurePage An object that contains information about a page on the site.
getSiteStructure( )

getSiteStructure( )

Returns information about the site's pages, prefixes, and lightboxes.

function wixSite.getSiteStructure(): SiteStructure

Return Value

SiteStructure An object that contains information about the site's pages, prefixes, and lightboxes.

Examples

Get information about the site's pages, prefixes, and lightboxes

This example gets the structure of the site with the following in its pages menu: Site Structure

aW1wb3J0IHdpeFNpdGUgZnJvbSAnd2l4LXNpdGUnOwoKLy8gLi4uCgpsZXQgc3RydWN0dXJlID0gd2l4U2l0ZS5nZXRTaXRlU3RydWN0dXJlKCk7CgovKgogKiB7CiAqIAkgInBhZ2VzIjogWwogKiAgICAgewogKiAgICAJCSJuYW1lIjogIkhPTUUiLAogKiAgICAJCSJ0eXBlIjogInN0YXRpYyIsCiAqICAgIAkJInVybCI6ICIvaG9tZSIKICogICAgIH0sCiAqICAgICB7CiAqICAgIAkJIm5hbWUiOiAiUGFyZW50IFBhZ2UiLAogKiAgICAJCSJ0eXBlIjogInN0YXRpYyIsCiAqICAgIAkJInVybCI6ICIvcGFyZW50LXBhZ2UiCiAqICAgICB9LAogKiAgICAgewogKiAgICAJCSJuYW1lIjogIkNoaWxkIFBhZ2UiLAogKiAgICAJCSJ0eXBlIjogInN0YXRpYyIsCiAqICAgIAkJInVybCI6ICIvY2hpbGQtcGFnZSIKICogICAgIH0sCiAqICAgICB7CiAqICAgIAkJIm5hbWUiOiAiUGFnZTEiLAogKiAgICAJCSJ0eXBlIjog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ZGZjZCIKICogICAgIH0sCiAqICAgICB7CiAqICAgIAkJIm5hbWUiOiAiVGhhbmsgWW91IFBhZ2UiLAogKiAgICAJCSJ0eXBlIjogInRlbXBsYXRlIiwKICogICAgCQkidXJsIjogIi90aGFuay15b3UtcGFnZSIsCiAqICAgIAkJImFwcGxpY2F0aW9uSWQiOiAiMTM4MGI3MDMtY2U4MS1mZjA1LWYxMTUtMzk1NzFkOTRkZmNkIgogKiAgICAgfQogKiAgIF0sCiAqIAkgInByZWZpeGVzIjogWwogKiAgICAgewogKiAgICAJCSJuYW1lIjogIm15Q29sbGVjdGlvbiIsCiAqICAgIAkJInR5cGUiOiAiZHluYW1pY1BhZ2VzIiwKICogICAgCQkicHJlZml4IjogIi9teUNvbGxlY3Rpb24iCiAqICAgICB9LAogKiAgICAgewogKiAgICAJCSJuYW1lIjogInJvdXRlciIsCiAqICAgIAkJInR5cGUiOiAicm91dGVyIiwKICogICAgCQkicHJlZml4IjogIi9yb3V0ZXIiCiAqICAgICB9LAogKiAgICAgewogKiAgICAJCSJuYW1lIjogIlNob3AiLAogKiAgICAJCSJ0eXBlIjogImFwcCIsCiAqICAgIAkJInByZWZpeCI6ICIvc2hvcCIsCiAqICAgIAkJImFwcGxpY2F0aW9uSWQiOiAiMTM4MGI3MDMtY2U4MS1mZjA1LWYxMTUtMzk1NzFkOTRkZmNkIgogKiAgICAgfSwKICogICAgIHsKICogICAgCQkibmFtZSI6ICJQcm9kdWN0IFBhZ2UiLAogKiAgICAJCSJ0eXBlIjogImFwcCIsCiAqICAgIAkJInByZWZpeCI6ICIvcHJvZHVjdC1wYWdlIiwKICogICAgCQkiYXBwbGljYXRpb25JZCI6ICIxMzgwYjcwMy1jZTgxLWZmMDUtZjExNS0zOTU3MWQ5NGRmY2QiCiAqICAgICB9LAogKiAgICAgewogKiAgICAJCSJuYW1lIjogIkNhcnQiLAogKiAgICAJCSJ0eXBlIjogImFwcCIsCiAqICAgIAkJInByZWZpeCI6ICIvY2FydCIsCiAqICAgIAkJImFwcGxpY2F0aW9uSWQiOiAiMTM4MGI3MDMtY2U4MS1mZjA1LWYxMTUtMzk1NzFkOTRkZmNkIgogKiAgICAgfSwKICogICAgIHsKICogICAgCQkibmFtZSI6ICJUaGFuayBZb3UgUGFnZSIsCiAqICAgIAkJInR5cGUiOiAiYXBwIiwKICogICAgCQkicHJlZml4IjogIi90aGFuay15b3UtcGFnZSIsCiAqICAgIAkJImFwcGxpY2F0aW9uSWQiOiAiMTM4MGI3MDMtY2U4MS1mZjA1LWYxMTUtMzk1NzFkOTRkZmNkIgogKiAgICAgfQogKiAgIF0sCiAqIAkgImxpZ2h0Ym94ZXMiOiBbCiAqICAgICB7CiAqIAkgCSAgIm5hbWUiOiAiV2VsY29tZSAoRnVsbCBTY3JlZW4pIgogKiAJICAgfQogKiAgIF0KICogfQogKi8K
import wixSite from 'wix-site';

// ...

let structure = wixSite.getSiteStructure();

/*
 * {
 * 	 "pages": [
 *     {
 *    		"name": "HOME",
 *    		"type": "static",
 *    		"url": "/home"
 *     },
 *     {
 *    		"name": "Parent Page",
 *    		"type": "static",
 *    		"url": "/parent-page"
 *     },
 *     {
 *    		"name": "Child Page",
 *    		"type": "static",
 *    		"url": "/child-page"
 *     },
 *     {
 *    		"name": "Page1",
 *    		"type": "static",
 *    		"url": "/page1"
 *     },
 *     {
 *    		"name": "Page2",
 *    		"type": "static",
 *    		"url": "/page2"
 *     },
 *     {
 *    		"name": "MyCollection (Title)",
 *    		"type": "template",
 *    		"prefix": "myCollection"
 *     },
 *     {
 *    		"name": "router-page",
 *    		"type": "template",
 *    		"prefix": "router"
 *     },
 *     {
 *    		"name": "Shop",
 *    		"type": "template",
 *    		"url": "/shop",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     },
 *     {
 *    		"name": "Product Page",
 *    		"type": "template",
 *    		"url": "/product-page",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     },
 *     {
 *    		"name": "Cart",
 *    		"type": "template",
 *    		"url": "/cart",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     },
 *     {
 *    		"name": "Thank You Page",
 *    		"type": "template",
 *    		"url": "/thank-you-page",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     }
 *   ],
 * 	 "prefixes": [
 *     {
 *    		"name": "myCollection",
 *    		"type": "dynamicPages",
 *    		"prefix": "/myCollection"
 *     },
 *     {
 *    		"name": "router",
 *    		"type": "router",
 *    		"prefix": "/router"
 *     },
 *     {
 *    		"name": "Shop",
 *    		"type": "app",
 *    		"prefix": "/shop",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     },
 *     {
 *    		"name": "Product Page",
 *    		"type": "app",
 *    		"prefix": "/product-page",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     },
 *     {
 *    		"name": "Cart",
 *    		"type": "app",
 *    		"prefix": "/cart",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     },
 *     {
 *    		"name": "Thank You Page",
 *    		"type": "app",
 *    		"prefix": "/thank-you-page",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     }
 *   ],
 * 	 "lightboxes": [
 *     {
 * 	 	  "name": "Welcome (Full Screen)"
 * 	   }
 *   ]
 * }
 */
routerSitemap( )

routerSitemap( )

Returns the sitemap for a router or dynamic page prefix.

function routerSitemap(routerPrefix: string): Promise<WixRouterSitemapEntry[]>

Description

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.

Parameters

routerPrefix String The prefix of the router to get the sitemap for.

Return Value

Returns a Promise

On fulfillment WixRouterSitemapEntry[ ] A list of sitemap entries.
On rejection Error The error that caused the rejection.

Examples

Get the sitemap for a prefix

aW1wb3J0IHdpeFNpdGUgZnJvbSAnd2l4LXNpdGUnOwoKLy8gLi4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yBQYWdlIgogKiAgIH0KICogXQogKi8K
import wixSite from 'wix-site';

// ...

wixSite.routerSitemap("routerPrefix")
  .then( (routerSitemap) => {
  	let 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"
 *   }
 * ]
 */
Prefix

Prefix

An object that contains information about the site's prefixes.

Description

A site's routers, dynamic pages, and app pages all have prefixes.

Type

Object

Properties

name String The name of the prefix.
type String The type of the prefix: "dynamicPages", "router", or "app".
prefix String The prefix.
applicationId (optional) String If the prefix is an app's prefix, the applicationId property is the app's ID.

Examples

Get information about the site's prefixes

This example gets the prefixes of the site with the following in its pages menu: Site Structure

aW1wb3J0IHdpeFNpdGUgZnJvbSAnd2l4LXNpdGUnOwoKLy8gLi4uCgpsZXQgc3RydWN0dXJlID0gd2l4U2l0ZS5nZXRTaXRlU3RydWN0dXJlKCk7CmxldCBwcmVmaXhlcyA9IHN0cnVjdHVyZS5wcmVmaXhlczsKCi8qCiAqICBwcmVmaXhlczoKICoKICogWwogKiAgIHsKICogICAgICJuYW1lIjogIm15Q29sbGVjdGlvbiIsCiAqICAgICAidHlwZSI6ICJkeW5hbWljUGFnZXMiLAogKiAgICAgInByZWZpeCI6ICIvbXlDb2xsZWN0aW9uIgogKiAgIH0sCiAqICAgewogKiAgICAgIm5hbWUiOiAicm91dGVyIiwKICogICAgICJ0eXBlIjogInJvdXRlciIsCiAqICAgICAicHJlZml4IjogIi9yb3V0ZXIiCiAqICAgfSwKICogICB7CiAqICAgICAibmFtZSI6ICJTaG9wIiwKICogICAgICJ0eXBlIjogImFwcCIsCiAqICAgICAicHJlZml4IjogIi9zaG9wIiwKICogIAkgImFwcGxpY2F0aW9uSWQiOiAiMTM4MGI3MDMtY2U4MS1mZjA1LWYxMTUtMzk1NzFkOTRkZmNkIgogKiAgIH0sCiAqICAgewogKiAgICAgIm5hbWUiOiAiUHJvZHVjdCBQYWdlIiwKICogICAgICJ0eXBlIjogImFwcCIsCiAqICAgICAicHJlZml4IjogIi9wcm9kdWN0LXBhZ2UiLAogKiAgCSAiYXBwbGljYXRpb25JZCI6ICIxMzgwYjcwMy1jZTgxLWZmMDUtZjExNS0zOTU3MWQ5NGRmY2QiCiAqICAgfSwKICogICB7CiAqICAgCSAibmFtZSI6ICJDYXJ0IiwKICogIAkgInR5cGUiOiAiYXBwIiwKICogIAkgInByZWZpeCI6ICIvY2FydCIsCiAqICAJICJhcHBsaWNhdGlvbklkIjogIjEzODBiNzAzLWNlODEtZmYwNS1mMTE1LTM5NTcxZDk0ZGZjZCIKICogICB9LAogKiAgIHsKICogICAgICJuYW1lIjogIlRoYW5rIFlvdSBQYWdlIiwKICogIAkgInR5cGUiOiAiYXBwIiwKICogIAkgInByZWZpeCI6ICIvdGhhbmsteW91LXBhZ2UiLAogKiAgCSAiYXBwbGljYXRpb25JZCI6ICIxMzgwYjcwMy1jZTgxLWZmMDUtZjExNS0zOTU3MWQ5NGRmY2QiCiAqICAgfQogKiBdCiAqLwo=
import wixSite from 'wix-site';

// ...

let structure = wixSite.getSiteStructure();
let prefixes = structure.prefixes;

/*
 *  prefixes:
 *
 * [
 *   {
 *     "name": "myCollection",
 *     "type": "dynamicPages",
 *     "prefix": "/myCollection"
 *   },
 *   {
 *     "name": "router",
 *     "type": "router",
 *     "prefix": "/router"
 *   },
 *   {
 *     "name": "Shop",
 *     "type": "app",
 *     "prefix": "/shop",
 *  	 "applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *   },
 *   {
 *     "name": "Product Page",
 *     "type": "app",
 *     "prefix": "/product-page",
 *  	 "applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *   },
 *   {
 *   	 "name": "Cart",
 *  	 "type": "app",
 *  	 "prefix": "/cart",
 *  	 "applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *   },
 *   {
 *     "name": "Thank You Page",
 *  	 "type": "app",
 *  	 "prefix": "/thank-you-page",
 *  	 "applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *   }
 * ]
 */

See Also

SiteStructure, getSiteStructure( )

SiteStructure

SiteStructure

An object that contains information about the site's pages, prefixes, and lightboxes.

Description

The SiteStructure object is a flattened representation of the site. Use the getSiteStructure() function to get the site's SiteStructure object. The structure does not include the headers and links from the site's Pages menu.

Type

Object

Properties

pages StructurePage[ ] The pages of the site.
prefixes Prefix[ ] The prefixes of the site's routers and dynamic pages.
lightboxes StructureLightbox[ ] The site's lightboxes.

Examples

Get information about the site's pages, prefixes, and lightboxes

This example gets the structure of the site with the following in its pages menu: Site Structure

aW1wb3J0IHdpeFNpdGUgZnJvbSAnd2l4LXNpdGUnOwoKLy8gLi4uCgpsZXQgc3RydWN0dXJlID0gd2l4U2l0ZS5nZXRTaXRlU3RydWN0dXJlKCk7CgovKgogKiB7CiAqIAkgInBhZ2VzIjogWwogKiAgICAgewogKiAgICAJCSJuYW1lIjogIkhPTUUiLAogKiAgICAJCSJ0eXBlIjogInN0YXRpYyIsCiAqICAgIAkJInVybCI6ICIvaG9tZSIKICogICAgIH0sCiAqICAgICB7CiAqICAgIAkJIm5hbWUiOiAiUGFyZW50IFBhZ2UiLAogKiAgICAJCSJ0eXBlIjogInN0YXRpYyIsCiAqICAgIAkJInVybCI6ICIvcGFyZW50LXBhZ2UiCiAqICAgICB9L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ogICAgIH0sCiAqICAgICB7CiAqICAgIAkJIm5hbWUiOiAiQ2FydCIsCiAqICAgIAkJInR5cGUiOiAidGVtcGxhdGUiLAogKiAgICAJCSJ1cmwiOiAiL2NhcnQiLAogKiAgICAJCSJhcHBsaWNhdGlvbklkIjogIjEzODBiNzAzLWNlODEtZmYwNS1mMTE1LTM5NTcxZDk0ZGZjZCIKICogICAgIH0sCiAqICAgICB7CiAqICAgIAkJIm5hbWUiOiAiVGhhbmsgWW91IFBhZ2UiLAogKiAgICAJCSJ0eXBlIjogInRlbXBsYXRlIiwKICogICAgCQkidXJsIjogIi90aGFuay15b3UtcGFnZSIsCiAqICAgIAkJImFwcGxpY2F0aW9uSWQiOiAiMTM4MGI3MDMtY2U4MS1mZjA1LWYxMTUtMzk1NzFkOTRkZmNkIgogKiAgICAgfQogKiAgIF0sCiAqIAkgInByZWZpeGVzIjogWwogKiAgICAgewogKiAgICAJCSJuYW1lIjogIm15Q29sbGVjdGlvbiIsCiAqICAgIAkJInR5cGUiOiAiZHluYW1pY1BhZ2VzIiwKICogICAgCQkicHJlZml4IjogIi9teUNvbGxlY3Rpb24iCiAqICAgICB9LAogKiAgICAgewogKiAgICAJCSJuYW1lIjogInJvdXRlciIsCiAqICAgIAkJInR5cGUiOiAicm91dGVyIiwKICogICAgCQkicHJlZml4IjogIi9yb3V0ZXIiCiAqICAgICB9LAogKiAgICAgewogKiAgICAJCSJuYW1lIjogIlNob3AiLAogKiAgICAJCSJ0eXBlIjogImFwcCIsCiAqICAgIAkJInByZWZpeCI6ICIvc2hvcCIsCiAqICAgIAkJImFwcGxpY2F0aW9uSWQiOiAiMTM4MGI3MDMtY2U4MS1mZjA1LWYxMTUtMzk1NzFkOTRkZmNkIgogKiAgICAgfSwKICogICAgIHsKICogICAgCQkibmFtZSI6ICJQcm9kdWN0IFBhZ2UiLAogKiAgICAJCSJ0eXBlIjogImFwcCIsCiAqICAgIAkJInByZWZpeCI6ICIvcHJvZHVjdC1wYWdlIiwKICogICAgCQkiYXBwbGljYXRpb25JZCI6ICIxMzgwYjcwMy1jZTgxLWZmMDUtZjExNS0zOTU3MWQ5NGRmY2QiCiAqICAgICB9LAogKiAgICAgewogKiAgICAJCSJuYW1lIjogIkNhcnQiLAogKiAgICAJCSJ0eXBlIjogImFwcCIsCiAqICAgIAkJInByZWZpeCI6ICIvY2FydCIsCiAqICAgIAkJImFwcGxpY2F0aW9uSWQiOiAiMTM4MGI3MDMtY2U4MS1mZjA1LWYxMTUtMzk1NzFkOTRkZmNkIgogKiAgICAgfSwKICogICAgIHsKICogICAgCQkibmFtZSI6ICJUaGFuayBZb3UgUGFnZSIsCiAqICAgIAkJInR5cGUiOiAiYXBwIiwKICogICAgCQkicHJlZml4IjogIi90aGFuay15b3UtcGFnZSIsCiAqICAgIAkJImFwcGxpY2F0aW9uSWQiOiAiMTM4MGI3MDMtY2U4MS1mZjA1LWYxMTUtMzk1NzFkOTRkZmNkIgogKiAgICAgfQogKiAgIF0sCiAqIAkgImxpZ2h0Ym94ZXMiOiBbCiAqICAgICB7CiAqIAkgCSAgIm5hbWUiOiAiV2VsY29tZSAoRnVsbCBTY3JlZW4pIgogKiAJICAgfQogKiAgIF0KICogfQogKi8K
import wixSite from 'wix-site';

// ...

let structure = wixSite.getSiteStructure();

/*
 * {
 * 	 "pages": [
 *     {
 *    		"name": "HOME",
 *    		"type": "static",
 *    		"url": "/home"
 *     },
 *     {
 *    		"name": "Parent Page",
 *    		"type": "static",
 *    		"url": "/parent-page"
 *     },
 *     {
 *    		"name": "Child Page",
 *    		"type": "static",
 *    		"url": "/child-page"
 *     },
 *     {
 *    		"name": "Page1",
 *    		"type": "static",
 *    		"url": "/page1"
 *     },
 *     {
 *    		"name": "Page2",
 *    		"type": "static",
 *    		"url": "/page2"
 *     },
 *     {
 *    		"name": "MyCollection (Title)",
 *    		"type": "template",
 *    		"prefix": "myCollection"
 *     },
 *     {
 *    		"name": "router-page",
 *    		"type": "template",
 *    		"prefix": "router"
 *     },
 *     {
 *    		"name": "Shop",
 *    		"type": "template",
 *    		"url": "/shop",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     },
 *     {
 *    		"name": "Product Page",
 *    		"type": "template",
 *    		"url": "/product-page",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     },
 *     {
 *    		"name": "Cart",
 *    		"type": "template",
 *    		"url": "/cart",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     },
 *     {
 *    		"name": "Thank You Page",
 *    		"type": "template",
 *    		"url": "/thank-you-page",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     }
 *   ],
 * 	 "prefixes": [
 *     {
 *    		"name": "myCollection",
 *    		"type": "dynamicPages",
 *    		"prefix": "/myCollection"
 *     },
 *     {
 *    		"name": "router",
 *    		"type": "router",
 *    		"prefix": "/router"
 *     },
 *     {
 *    		"name": "Shop",
 *    		"type": "app",
 *    		"prefix": "/shop",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     },
 *     {
 *    		"name": "Product Page",
 *    		"type": "app",
 *    		"prefix": "/product-page",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     },
 *     {
 *    		"name": "Cart",
 *    		"type": "app",
 *    		"prefix": "/cart",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     },
 *     {
 *    		"name": "Thank You Page",
 *    		"type": "app",
 *    		"prefix": "/thank-you-page",
 *    		"applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *     }
 *   ],
 * 	 "lightboxes": [
 *     {
 * 	 	  "name": "Welcome (Full Screen)"
 * 	   }
 *   ]
 * }
 */

See Also

getSiteStructure( )

StructureLightbox

StructureLightbox

An object that contains information about a lightbox on the site.

Type

Object

Properties

name String The name of the lightbox.

Examples

Get information about the site's lightboxes

This example gets the lightboxes of the site with the following in its pages menu: Site Structure

aW1wb3J0IHdpeFNpdGUgZnJvbSAnd2l4LXNpdGUnOwoKLy8gLi4uCgpsZXQgc3RydWN0dXJlID0gd2l4U2l0ZS5nZXRTaXRlU3RydWN0dXJlKCk7CmxldCBsaWdodGJveGVzID0gc3RydWN0dXJlLmxpZ2h0Ym94ZXM7CgovKgogKiBsaWdodGJveGVzOgogKgogKiBbCiAqICAgewogKiAJICAgIm5hbWUiOiAiV2VsY29tZSAoRnVsbCBTY3JlZW4pIgogKiAgIH0KICogXQogKi8K
import wixSite from 'wix-site';

// ...

let structure = wixSite.getSiteStructure();
let lightboxes = structure.lightboxes;

/*
 * lightboxes:
 *
 * [
 *   {
 * 	   "name": "Welcome (Full Screen)"
 *   }
 * ]
 */

See Also

SiteStructure, getSiteStructure( )

StructurePage

StructurePage

An object that contains information about a page on the site.

Description

The StructurePage object represents a page in the site. The page can be a regular page, dynamic page, router page, or page from an app.

Type

Object

Properties

name String The of the page.
type String The type of the page: "static" or "template".
url (optional) String The URL of the page. If the page is a static page the url property is the page's SEO URL.
applicationId (optional) String If the page is an app page, the applicationId property is the app's ID.
prefix (optional) String If the page is a router or dynamic page, the prefix property is the page's prefix.

Examples

Get information about the site's pages

This example gets the pages of the site with the following in its pages menu: Site Structure

aW1wb3J0IHdpeFNpdGUgZnJvbSAnd2l4LXNpdGUnOwoKLy8gLi4uCgpsZXQgc3RydWN0dXJlID0gd2l4U2l0ZS5nZXRTaXRlU3RydWN0dXJlKCk7CmxldCBwYWdlcyA9IHN0cnVjdHVyZS5wYWdlczsKCi8qCiAqIHBhZ2VzOgogKgogKiBbCiAqICAgewogKiAgICAgIm5hbWUiOiAiSE9NRSIsCiAqICAgICAidHlwZSI6ICJzdGF0aWMiLAogKiAgICAgInVybCI6ICIvaG9tZSIKICogICB9LAogKiAgIHsKICogICAgICJuYW1lIjogIlBhcmVudCBQYWdlIiwKICogICAgICJ0eXBlIjogInN0YXRpYyIsCiAqICAgICAidXJsIjogIi9wYXJlbnQtcGFnZSIKICogICB9LAogKiAgIHsKICogICAgICJuYW1lIjogIkNoaWxkIFBhZ2UiLAogKiAgICAgInR5cGUiOiAic3RhdGljIiwKICogICAgICJ1cmwiOiAiL2NoaWxkLXBhZ2UiCiAqICAgfSwKICogICB7CiAqICAgICAibmFtZSI6ICJQYWdlMSIsCiAqICAgICAidHlwZSI6ICJzdGF0aWMiLAogKiAgICAgInVybCI6ICIvcGFnZTEiCiAqICAgfSwKICogICB7CiAqICAgICAibmFtZSI6ICJQYWdlMiIsCiAqICAgICAidHlwZSI6ICJzdGF0aWMiLAogKiAgICAgInVybCI6ICIvcGFnZTIiCiAqICAgfSwKICogICB7CiAqICAgICAibmFtZSI6ICJNeUNvbGxlY3Rpb24gKFRpdGxlKSIsCiAqICAgICAidHlwZSI6ICJ0ZW1wbGF0ZSIsCiAqICAgICAicHJlZml4IjogIm15Q29sbGVjdGlvbiIKICogICB9LAogKiAgIHsKICogICAgICJuYW1lIjogInJvdXRlci1wYWdlIiwKICogICAgICJ0eXBlIjogInRlbXBsYXRlIiwKICogICAgICJwcmVmaXgiOiAicm91dGVyIgogKiAgIH0sCiAqICAgewogKiAgICAgIm5hbWUiOiAiU2hvcCIsCiAqICAJICJ0eXBlIjogInRlbXBsYXRlIiwKICogIAkgInVybCI6ICIvc2hvcCIsCiAqICAJICJhcHBsaWNhdGlvbklkIjogIjEzODBiNzAzLWNlODEtZmYwNS1mMTE1LTM5NTcxZDk0ZGZjZCIKICogICB9LAogKiAgIHsKICogIAkgIm5hbWUiOiAiUHJvZHVjdCBQYWdlIiwKICogIAkgInR5cGUiOiAidGVtcGxhdGUiLAogKiAgCSAidXJsIjogIi9wcm9kdWN0LXBhZ2UiLAogKiAgCSAiYXBwbGljYXRpb25JZCI6ICIxMzgwYjcwMy1jZTgxLWZmMDUtZjExNS0zOTU3MWQ5NGRmY2QiCiAqICAgfSwKICogICB7CiAqICAJICJuYW1lIjogIkNhcnQiLAogKiAgCSAidHlwZSI6ICJ0ZW1wbGF0ZSIsCiAqICAJICJ1cmwiOiAiL2NhcnQiLAogKiAgCSAiYXBwbGljYXRpb25JZCI6ICIxMzgwYjcwMy1jZTgxLWZmMDUtZjExNS0zOTU3MWQ5NGRmY2QiCiAqICAgfSwKICogICB7CiAqICAJICJuYW1lIjogIlRoYW5rIFlvdSBQYWdlIiwKICogIAkgInR5cGUiOiAidGVtcGxhdGUiLAogKiAgCSAidXJsIjogIi90aGFuay15b3UtcGFnZSIsCiAqICAJICJhcHBsaWNhdGlvbklkIjogIjEzODBiNzAzLWNlODEtZmYwNS1mMTE1LTM5NTcxZDk0ZGZjZCIKICogICB9CiAqIF0KICovCg==
import wixSite from 'wix-site';

// ...

let structure = wixSite.getSiteStructure();
let pages = structure.pages;

/*
 * pages:
 *
 * [
 *   {
 *     "name": "HOME",
 *     "type": "static",
 *     "url": "/home"
 *   },
 *   {
 *     "name": "Parent Page",
 *     "type": "static",
 *     "url": "/parent-page"
 *   },
 *   {
 *     "name": "Child Page",
 *     "type": "static",
 *     "url": "/child-page"
 *   },
 *   {
 *     "name": "Page1",
 *     "type": "static",
 *     "url": "/page1"
 *   },
 *   {
 *     "name": "Page2",
 *     "type": "static",
 *     "url": "/page2"
 *   },
 *   {
 *     "name": "MyCollection (Title)",
 *     "type": "template",
 *     "prefix": "myCollection"
 *   },
 *   {
 *     "name": "router-page",
 *     "type": "template",
 *     "prefix": "router"
 *   },
 *   {
 *     "name": "Shop",
 *  	 "type": "template",
 *  	 "url": "/shop",
 *  	 "applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *   },
 *   {
 *  	 "name": "Product Page",
 *  	 "type": "template",
 *  	 "url": "/product-page",
 *  	 "applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *   },
 *   {
 *  	 "name": "Cart",
 *  	 "type": "template",
 *  	 "url": "/cart",
 *  	 "applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *   },
 *   {
 *  	 "name": "Thank You Page",
 *  	 "type": "template",
 *  	 "url": "/thank-you-page",
 *  	 "applicationId": "1380b703-ce81-ff05-f115-39571d94dfcd"
 *   }
 * ]
 */

See Also

SiteStructure, getSiteStructure( )