TentoCMS
Classes

Class: BlogPostsResource

Blog posts sub-resource

Blog posts sub-resource

Methods

getBySlug()

getBySlug(slug, options?): Promise<BlogPost>;

Get a single blog post by its slug

Parameters

ParameterTypeDescription
slugstringThe post slug
options?PreviewOption & MediaOption-

Returns

Promise<BlogPost>

The blog post object

Throws

If the post is not found

Example

const post = await client.blog.posts.getBySlug('my-first-post')
console.log(post.title)
console.log(post.content)

list()

list(options?): Promise<BlogPostListResponse>;

List all published blog posts

Parameters

ParameterTypeDescription
options?BlogPostListOptionsQuery options for filtering, pagination, and sorting

Returns

Promise<BlogPostListResponse>

Paginated list of blog posts

Example

// Get latest posts
const result = await client.blog.posts.list({
  page: 1,
  limit: 10,
  sort: '-publishedAt'
})

// Filter by category
const categoryPosts = await client.blog.posts.list({
  categoryId: 'cat123'
})

// Search posts
const searchResults = await client.blog.posts.list({
  search: 'typescript'
})

// Opt in to full post body — list responses omit `content` unless includeContent is set
const withBodies = await client.blog.posts.list({ includeContent: true })

// With filters
const filtered = await client.blog.posts.list({
  filters: [
    { field: 'publishedAt', operator: 'gte', value: '2024-01-01' }
  ]
})
Copyright © 2026