The Ricos Site Context API provides site-level context for rich content editors: the pages of the current Wix site that content can link to, and the site's base URL.
With the Ricos Site Context API, you can:
- Retrieve the base URL of the site and whether the site is published.
- List the static pages of the site.
- List the dynamic pages of the site, and whether each one is the template of item pages.
- List the item pages of a dynamic page.
It's important to note the following points before starting to code:
- Static pages are sorted by title and returned with cursor paging. Dynamic pages are returned in one response, without paging. Item pages are returned with cursor paging. The default page size is 50, and the maximum is 100.
- Static pages include the home page, pages that no Wix app manages, and the main pages of some Wix apps, such as the blog or the cart page. Other pages of Wix apps aren't included.
- Static pages aren't filtered by whether they are hidden, password-protected or restricted to site members.
- Dynamic pages include pages of Wix Data collections, and dynamic pages that no Wix app manages.
- To list the item pages of a dynamic page, specify its
path as prefix, and its id as pageId.
- The
id of an item page is an opaque key, not a page ID or a collection item ID. Don't specify it as pageId.
- Store the
path of a page as the link target, not its url. The url depends on the site's domain, which can change.
- Item pages are read from the published version of the site. Check the
published field of the response. If it's false, item pages aren't available yet.
Typical scenarios for using the Ricos Site Context API include:
- Static page - A page with a fixed path in the site.
- Dynamic page - A page template that generates one page for each item in a collection.
- Item page - One of the pages that a dynamic page generates, for a single item of a collection.
- Base URL - The URL of the site, without a trailing slash. Every page
path starts with /, so a page URL is the base URL followed by the path. Each page's url field already holds the full URL.