DocumentationAmertaThemeUtilitiesBlogFunctions

Get Blog Posts By Category

amerta


amerta / amerta/theme/utilities/blog / getBlogPostsByCategory

Function: getBlogPostsByCategory()

getBlogPostsByCategory(limit): Promise<PaginatedDocs<Post>>

Defined in: amerta/theme/utilities/blog.ts:62

Retrieves blog posts filtered by a specific category.

Parameters

| Parameter | Type | Description | | ------ | ------ | ------ | | limit | { category: string; filter?: Record<string, any>; limit?: number; locale?: string; page?: string; sort?: string; } | Maximum number of posts to return per page. | | limit.category | string | - | | limit.filter? | Record<string, any> | - | | limit.limit? | number | - | | limit.locale? | string | - | | limit.page? | string | - | | limit.sort? | string | - |

Returns

Promise<PaginatedDocs<Post>>

Paginated posts result filtered by category.

Example

const posts = await getBlogPostsByCategory({ limit: 10, page: "1", category: "cat123", locale: "en" });