Setup
To use the Tags API, install the @wix/blog
package using npm or Yarn:
1npm install @wix/blog
or
1yarn add @wix/blog
Then import { tags }
from @wix/blog
:
1import { tags } from '@wix/blog'
Gets a tag by the specified ID.
The getTag()
function returns a Promise that resolves to a tag whose ID matches the specified ID.
Permission Scopes
For app development, you must have one of the following permission scopes:function getTag(tagId: string, options: GetTagOptions): Promise<BlogTag>
Tag ID.
Options specifying which additional fields to return.
Gets a tag by the specified label.
The getTagByLabel()
function returns a Promise that resolves to a tag whose label matches the specified label.
Permission Scopes
For app development, you must have one of the following permission scopes:function getTagByLabel(label: string, options: GetTagByLabelOptions): Promise<GetTagByLabelResponse>
Tag label.
Options specifying which additional fields to return.
Gets a tag by the specified slug.
The getTagBySlug()
function returns a Promise that resolves to a tag whose slug matches the specified slug.
The slug
is the end of a tag's URL that refers to a specific tag. For example, if a tag's URL is https://example.com/blog/tag/{my-tag-slug}
, the slug is my-tag-slug
. The slug is case-sensitive and derived from the tag's label
.
Permission Scopes
For app development, you must have one of the following permission scopes:function getTagBySlug(slug: string, options: GetTagBySlugOptions): Promise<GetTagBySlugResponse>
Slug of the tag to retrieve.
Options specifying which additional fields to return.
Creates a query to retrieve a list of tags.
The queryTags()
function builds a query to retrieve a list of up to 4,000 tags per language, and returns a TagsQueryBuilder
object.
The returned object contains the query definition, which is typically used to run the query using the find()
function.
You can refine the query by chaining TagsQueryBuilder
functions onto the query. TagsQueryBuilder
functions enable you to sort, filter, and control the results that queryTags()
returns.
queryTags()
runs with these TagsQueryBuilder
defaults that can be overridden:
The following TagQueryBuilder
functions are supported for queryTags()
. For a full description of the Tags object, see the object returned for the items
property in TagsQueryResult
.
PROPERTY | SUPPORTED FILTERS & SORTING |
---|---|
_id | eq() ,ne() ,hasSome() |
label | eq() ,ne() ,startsWith() ,hasSome() ,exists() ,in() ,ascending() ,descending() |
slug | eq() ,ne() ,startsWith() ,hasSome() ,exists() ,in() ,ascending() ,descending() |
publicationCount | eq() ,ne() ,lt() ,le() ,gt() ,ge() ,in() ,ascending() ,descending() |
postCount | eq() ,ne() ,lt() ,le() ,gt() ,ge() ,in() ,ascending() ,descending() |
translationId | eq() ,ne() ,exists() ,in() |
language | eq() ,ne() ,exists() ,in() ,ascending() ,descending() |
Permission Scopes
For app development, you must have one of the following permission scopes:function queryTags(options: QueryTagsOptions): TagsQueryBuilder
Options specifying which fields to return.