Gets the site's regional settings.
The retrieved regional settings corresponds to the regional settings that has been entered in the General Info section of your site's Dashboard.
The regional settings are used to determine how numbers, dates, and currencies are displayed on your site.
import wixSiteFrontend from "wix-site-frontend";
// ...
const regionalSettings = wixSiteFrontend.regionalSettings; // "en-us"
Gets the site revision ID.
The site revision ID is a unique identifier for the current revision of your site. Each time you manually save your site or publish your site following a change, a new revision is created.
You can view and manage your site revisions in your Site History. You can use site monitoring to monitor and debug new revisions of your site.
Notes:
Since publishing your site may change the revision ID, the ID when previewing your site may be different than the ID for the published site.
The site revision ID is guaranteed to be unique, but not meaningful. Therefore, you cannot predict future revision IDs before they are created.
import wixSiteFrontend from "wix-site-frontend";
// ...
const revision = wixSiteFrontend.revision; // "4x2y"
Gets the site's timezone.
The retrieved timezone is the timezone that has been entered in the General Info section of your site's Dashboard.
The timezone is used your site, apps (e.g. Wix Stores, Wix Bookings), and other Wix features.
import wixSiteFrontend from "wix-site-frontend";
// ...
const timezone = wixSiteFrontend.timezone; // "America/New_York"
Gets the site display name.
Retrieves the site display name, which is the name that has been entered in the Website Settings section of the site's Dashboard.
function getSiteDisplayName(): string;
import wixSiteFrontend from "wix-site-frontend";
const siteName = wixSiteFrontend.getSiteDisplayName(); // "My Site"
Returns information about the site's pages, prefixes, and lightboxes.
The returned SiteStructure
object is a flattened representation of the site.
The structure does not include the headers and links from the site's Pages menu.
function getSiteStructure(): SiteStructure;
This example gets the structure of the site with the following in its pages menu:
import wixSiteFrontend from "wix-site-frontend";
// ...
const structure = wixSiteFrontend.getSiteStructure();
/*
* {
* "pages": [
* {
* "name": "Home",
* "type": "static",
* "url": "/home",
* "isHomePage": true
* },
* {
* "name": "Page 1",
* "type": "static",
* "url:" /page-1"
* },
* {
* "name": "Page 2",
* "type": "static",
* "url": "/page-2"
* },
* {
* "name": "Parent Page",
* "type": "static",
* "url": "/parent-page"
* },
* {
* "name": "Child Page",
* "type": "static",
* "url": "/child-page"
* },
* {
* "name": "router-page",
* "type": "template",
* "prefix": "router"
* },
* {
* "name": "MyCollection (Title)",
* "type": "template",
* "prefix": "MyCollection"
* },
* {
* "name": "MyCollection (All)",
* "type": "template",
* "prefix": "MyCollection"
* },
* {
* "name": "Dashboard Page",
* "type": "static"
* },
* {
* "name": "Shop",
* "type": "template",
* "url": "/shop",
* "applicationId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
* },
* {
* "name": "Product Page",
* "type": "template",
* "url": "/product-page",
* "applicationId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
* },
* {
* "name": "Thank You Page",
* "type": "template",
* "url": "/thank-you-page",
* "applicationId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
* },
* {
* "name": "Cart",
* "type": "template",
* "url": "/cart",
* "applicationId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
* },
* {
* "name": "Members",
* "type": "template",
* "url": "/members",
* "applicationId": "14ad9202-3dd3-128a-57bd-e5675fd7e313"
* }
* ],
* "prefixes": [
* {
* "name": "router",
* "type": "router",
* "prefix": "/router"
* },
* {
* "name": "MyCollection",
* "type": "dynamicPages",
* "prefix": "/MyCollection"
* },
* {
* "name": "MyCollection",
* "type": "dynamicPages",
* "prefix": "/MyCollection"
* },
* {
* "name": "Shop",
* "type": "app",
* "prefix: "/shop",
* "applicationId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
* },
* {
* "name": "Product Page",
* "type": "app",
* "prefix": "/product-page",
* "applicationId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
* },
* {
* "name": "Thank You Page",
* "type": "app",
* "prefix": "/thank-you-page",
* "applicationId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
* },
* {
* "name": "Cart",
* "type": "app",
* "url": "/cart",
* "applicationId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
* },
* {
* "name": "Members",
* "type": "app",
* "prefix": "/members",
* "applicationId": "14ad9202-3dd3-128a-57bd-e5675fd7e313"
* }
* ],
* "lightboxes": [
* {
* "name": "Welcome (Full Screen)"
* }
* ]
* }
*/
Optimizes resource fetching of pages and lightboxes in the site so they will load faster.
Use the prefetchPageResources()
function to optimize resource fetching of pages and
lightboxes you think your site visitors are likely to visit next. When the site
visitor navigates to those pages or lightboxes, they will load quicker than usual
since some of their resources have already been retrieved.
You can only prefetch resources from pages or lightboxes within the current site.
A prefetch is considered successful if the specified pages and lightboxes exist in the current site. If any of the specified pages or lightboxes do not exist, the prefetch operation returns an error status and lists of the pages and lightboxes that were not found.
function prefetchPageResources(prefetchItems: PrefetchItems): PrefetchResult;
The items within the site to prefetch resources for.
const response = wixSiteFrontend.prefetchPageResources({
lightboxes: ["First Box", "Second Box"],
pages: ["/first-page", "/second-page"],
});
if (response.errors) {
// handle errors
}
/*
* response is:
*
* {
* "message": "success"
* }
*/
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.
function routerSitemap(
routerPrefix: string,
): Promise<Array<WixRouterSitemapEntry>>;
The prefix of the router to get the sitemap for.
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"
* }
* ]
*/