Classes
Class: PagesResource
Pages resource for interacting with the TentoCMS Pages API
Pages resource for interacting with the TentoCMS Pages API
Methods
getBySlug()
Call Signature
getBySlug<TContent>(slug, options?): Promise<Page<TContent>>;
Get a single page by its slug
Type Parameters
| Type Parameter | Default type |
|---|---|
TContent | Record<string, unknown> |
Parameters
| Parameter | Type | Description |
|---|---|---|
slug | string | The page slug |
options? | PageGetOptions & object | Optional query options (e.g., pageType to disambiguate shared slugs) |
Returns
Promise<Page<TContent>>
The page object
Throws
If the page is not found
Example
const page = await client.pages.getBySlug('home')
// Disambiguate when multiple page types share the same slug
const landing = await client.pages.getBySlug('about', { pageType: 'landing-page' })
Call Signature
getBySlug<TContent>(slug, options): Promise<PageWithRedirect<TContent>>;
Get a single page by its slug
Type Parameters
| Type Parameter | Default type |
|---|---|
TContent | Record<string, unknown> |
Parameters
| Parameter | Type | Description |
|---|---|---|
slug | string | The page slug |
options | PageGetOptions & object | Optional query options (e.g., pageType to disambiguate shared slugs) |
Returns
Promise<PageWithRedirect<TContent>>
The page object
Throws
If the page is not found
Example
const page = await client.pages.getBySlug('home')
// Disambiguate when multiple page types share the same slug
const landing = await client.pages.getBySlug('about', { pageType: 'landing-page' })
list()
list<TContent>(options?): Promise<ListResponse<Page<TContent>>>;
List all published pages
Type Parameters
| Type Parameter | Default type |
|---|---|
TContent | Record<string, unknown> |
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | PageListOptions | Query options for filtering, pagination, and sorting |
Returns
Promise<ListResponse<Page<TContent>>>
Paginated list of pages
Example
// Basic list
const result = await client.pages.list({ page: 1, limit: 10 })
// With filters
const filtered = await client.pages.list({
page: 1,
filters: [
{ field: 'slug', operator: 'eq', value: 'home' }
]
})

