DocumentationAmertaThemeUtilitiesBlogFunctions

Get Tag By Slug

amerta


amerta / amerta/theme/utilities/blog / getTagBySlug

Function: getTagBySlug()

getTagBySlug(slug, locale?): Promise<Tag | null>

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

Retrieves a tag by its slug.

Parameters

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

Returns

Promise<Tag | null>

The tag or null if not found.

Example

const tag = await getTagBySlug("javascript", "en");