DocumentationAmertaThemeUtilitiesBlogFunctions

Get Blog Post By Handle

amerta


amerta / amerta/theme/utilities/blog / getBlogPostByHandle

Function: getBlogPostByHandle()

getBlogPostByHandle(handle, locale?): Promise<Post | null>

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

Retrieves a single blog post by its slug handle.

Parameters

| Parameter | Type | Description | | ------ | ------ | ------ | | handle | string | The slug of the blog post. | | locale? | string | Optional locale code for localization. |

Returns

Promise<Post | null>

The blog post or null if not found.

Example

const post = await getBlogPostByHandle("my-post", "en");