To use the Site API, install the @wix/site-site
package.
Follow the installation instructions for your development environment.
Development environment | Installation method |
---|---|
Wix sites (editor or IDE) | Use the package manager. |
Wix sites (local IDE) | Run wix install @wix/site-site using the Wix CLI. |
Blocks apps | Use the same installation method as Wix sites. |
CLI and self-hosted apps | Run npm install @wix/site-site or yarn add @wix/site-site . |
To import the package in your code:
import { site } from "@wix/site-site";
Gets a code representing the site's currency.
The retrieved currency code corresponds to the currency that has been entered in the General Info section of your site's Dashboard.
The currency is used your site, apps (e.g. Wix Stores, Wix Bookings), and other Wix features.
function currency(): Promise<string>;
import { site } from "@wix/site-site";
// ...
const currency = await site.currency(); // "USD"
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
Gets information about the current page or lightbox.
function currentPage(): Promise<StructurePage>;
import { site } from "@wix/site-site";
// ...
const currentPage = await site.currentPage();
/* Promise resolves to:
* {
* "name": "Home",
* "type": "static",
* "url": "/home",
* "isHomePage": true
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.