> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# ListDynamicPages

# Package: richContent

# Namespace: RicosSiteContext

# Method link: https://dev.wix.com/docs/api-reference/assets/rich-content/site-context-v1/list-dynamic-pages.md

## Permission Scopes:
Read Site Context for Rich Content: SCOPE.DC-RICOS.READ-SITE-CONTEXT

## Introduction

Lists the dynamic pages of the current site, in the order the site stores them. Only dynamic pages of Wix Data collections, and dynamic pages that no Wix app manages, are returned. All pages are returned in one response, without paging.

A dynamic page is a page template that generates one page for each item of a collection. Each page indicates whether it's the template of the item pages (`hasItemPages`). To list the item pages of a dynamic page, call [List Dynamic Item Pages](https://dev.wix.com/docs/api-reference/assets/rich-content/site-context-v1/list-dynamic-item-pages.md).

---

## REST API

### Schema

```
 Method: listDynamicPages
 Description: Lists the dynamic pages of the current site, in the order the site stores them. Only dynamic pages of Wix Data collections, and dynamic pages that no Wix app manages, are returned. All pages are returned in one response, without paging.  A dynamic page is a page template that generates one page for each item of a collection. Each page indicates whether it's the template of the item pages (`hasItemPages`). To list the item pages of a dynamic page, call [List Dynamic Item Pages](https://dev.wix.com/docs/api-reference/assets/rich-content/site-context-v1/list-dynamic-item-pages.md).
 URL: https://www.wixapis.com/ricos/v1/site-context/dynamic-pages/list
 Method: POST
 Return type: ListDynamicPagesResponse
  - name: items | type: array<SitePage> | description: Dynamic pages of the site.  
     - name: id | type: string | description: Page GUID of a static page or a dynamic page. For an item page, this is an opaque key that identifies the item page. It isn't a page GUID or a collection item GUID, so don't specify it as `pageId` in [List Dynamic Item Pages](https://dev.wix.com/docs/api-reference/assets/rich-content/site-context-v1/list-dynamic-item-pages.md), and don't parse it.  | validation: maxLength 300
     - name: title | type: string | description: Page title. For an item page, the name of the item. Empty if the item has no name.  | validation: maxLength 1000
     - name: path | type: string | description: Path of the page within the site. Store `path`, not `url`, as the link target, because it doesn't depend on the site's domain.  Always starts with `/`. For example: + Static page: includes the paths of the parent pages. For example, `/about/team`. + Dynamic page: the path shared by its item pages. For example, `/items`. + Item page: the dynamic page's path followed by the item's path. For example, `/items/first-item`.  | validation: maxLength 2000
     - name: url | type: string | description: Full URL of the page: the site's base URL followed by `path`. Use it to display or preview the link, but don't store it.  | validation: maxLength 4000
     - name: hasItemPages | type: boolean | description: Whether the dynamic page is the template of the item pages, as opposed to the page that lists the items. Returned only for dynamic pages. `false` is also returned for a dynamic page that has no item pages. If the site isn't published, item pages aren't available yet.  
  - name: published | type: boolean | description: Whether the site is published. If `false`, page URLs can't be reached by visitors yet.  
  - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata. All dynamic pages are returned in one response, so `hasNext` is always `false`.  
     - name: count | type: integer | description: Number of items returned in the current response.  | validation: format int32
     - name: cursors | type: Cursors | description: Navigation cursors for moving between result pages.  
        - name: next | type: string | description: Cursor for retrieving the next page of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor for retrieving the previous page of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page.  


```

### Examples

### List dynamic pages
Retrieves the dynamic pages of the site

```curl
curl -X POST \
'https://www.wixapis.com/ricos/v1/site-context/dynamic-pages/list' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.richContent.ricosSiteContext.listDynamicPages()
 Description: Lists the dynamic pages of the current site, in the order the site stores them. Only dynamic pages of Wix Data collections, and dynamic pages that no Wix app manages, are returned. All pages are returned in one response, without paging.  A dynamic page is a page template that generates one page for each item of a collection. Each page indicates whether it's the template of the item pages (`hasItemPages`). To list the item pages of a dynamic page, call [List Dynamic Item Pages](https://dev.wix.com/docs/api-reference/assets/rich-content/site-context-v1/list-dynamic-item-pages.md).
 Return type: PROMISE<ListDynamicPagesResponse>
  - name: items | type: array<SitePage> | description: Dynamic pages of the site.  
     - name: _id | type: string | description: Page GUID of a static page or a dynamic page. For an item page, this is an opaque key that identifies the item page. It isn't a page GUID or a collection item GUID, so don't specify it as `pageId` in [List Dynamic Item Pages](https://dev.wix.com/docs/api-reference/assets/rich-content/site-context-v1/list-dynamic-item-pages.md), and don't parse it.  | validation: maxLength 300
     - name: title | type: string | description: Page title. For an item page, the name of the item. Empty if the item has no name.  | validation: maxLength 1000
     - name: path | type: string | description: Path of the page within the site. Store `path`, not `url`, as the link target, because it doesn't depend on the site's domain.  Always starts with `/`. For example: + Static page: includes the paths of the parent pages. For example, `/about/team`. + Dynamic page: the path shared by its item pages. For example, `/items`. + Item page: the dynamic page's path followed by the item's path. For example, `/items/first-item`.  | validation: maxLength 2000
     - name: url | type: string | description: Full URL of the page: the site's base URL followed by `path`. Use it to display or preview the link, but don't store it.  | validation: maxLength 4000
     - name: hasItemPages | type: boolean | description: Whether the dynamic page is the template of the item pages, as opposed to the page that lists the items. Returned only for dynamic pages. `false` is also returned for a dynamic page that has no item pages. If the site isn't published, item pages aren't available yet.  
  - name: published | type: boolean | description: Whether the site is published. If `false`, page URLs can't be reached by visitors yet.  
  - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata. All dynamic pages are returned in one response, so `hasNext` is always `false`.  
     - name: count | type: integer | description: Number of items returned in the current response.  | validation: format int32
     - name: cursors | type: Cursors | description: Navigation cursors for moving between result pages.  
        - name: next | type: string | description: Cursor for retrieving the next page of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor for retrieving the previous page of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page.  


```

### Examples

### List dynamic pages
Retrieves the dynamic pages of the site.

```javascript
import { ricosSiteContext } from "@wix/rich-content";

async function listDynamicPages() {
  const response = await ricosSiteContext.listDynamicPages();
}

/* Promise resolves to:
 * {
 *   "items": [
 *     {
 *       "_id": "y80wh",
 *       "title": "Items (List)",
 *       "path": "/items",
 *       "url": "https://username.wixsite.com/mysite/items",
 *       "hasItemPages": false
 *     },
 *     {
 *       "_id": "es8i1",
 *       "title": "Items (Item)",
 *       "path": "/items",
 *       "url": "https://username.wixsite.com/mysite/items",
 *       "hasItemPages": true
 *     }
 *   ],
 *   "published": true,
 *   "pagingMetadata": {
 *     "count": 2,
 *     "hasNext": false
 *   }
 * }
 */

```

### listDynamicPages (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { ricosSiteContext } from '@wix/rich-content';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { ricosSiteContext },
  // Include the auth strategy and host as relevant
});


async function listDynamicPages() {
  const response = await myWixClient.ricosSiteContext.listDynamicPages();
};
```

---