Search.../

items

Returns an array of posts items that match the query.

Description

items contains the current page of results retrieved by the query. If no results match the query, items is an empty array. The page size is defined by the limit() function and can be retrieved using the pageSize property. You can use the next() and prev() functions returned by posts to navigate the pages of a query result.

Type:

Array<
Post
>
NAME
TYPE
DESCRIPTION
_id
string

Post ID.

categoryIds
Array<
string
>

Category IDs of the post.

commentingEnabled
boolean

Whether commenting on the post is enabled.

contactId
string

Post owner's contact ID.

content
string

Reserved for internal use.

contentId
string

Reserved for internal use.

contentText
string

The post's content in plain text.

coverMedia
CoverMedia

Reserved for internal use.

excerpt
string

Post excerpt. Can be selected by a site contributor. By default, it is extracted from the content text's first characters.

Max: 500 characters

featured
boolean

Whether the post is marked as featured.

firstPublishedDate
Date

Date the post was first published.

hasUnpublishedChanges
boolean

Indicates if there is a draft post with changes that have not yet been published.

hashtags
Array<
string
>

Hashtags in the post.

heroImage
string

Image placed at the top of the blog page. Only displays on mobile devices.

internalCategoryIds
Array<
string
>

Reserved for internal use.

internalId
string

Reserved for internal use.

internalRelatedPostIds
Array<
string
>

Reserved for internal use.

language
string

Language the post is written in.

2-letter language code in ISO 639-1 alpha-2 format.

lastPublishedDate
Date

Date the post was last published.

media
BlogMedia

Post cover media.

memberId
string

Post owner's member ID.

minutesToRead
number

Estimated reading time.

moderationDetails
ModerationDetails

Post moderation details.

Only relevant to posts submitted by guest writers. Guest writers have the ability to write posts but not publish them. These posts can be rejected or approved for publishing by a blog editor or site owner.

mostRecentContributorId
string

Reserved for internal use.

pinned
boolean

Whether the post is pinned. If true, the post is placed at the top of the post list.

preview
boolean

Whether the returned content is a preview of premium content. Defaults to false. A preview displays a limited number of paragraphs of paid content to non-subscribed users.

pricingPlanIds
Array<
string
>

Pricing plan IDs.

If a post is assigned to a specific pricing plan.

relatedPostIds
Array<
string
>

IDs of posts related to the post.

richContent
RichContent

Post rich content

seoData
SeoSchema

SEO data.

slug
string

Part of a post's URL that refers to a specific post.

For example, 'https:/example.com/posts/my-post-slug'.

tagIds
Array<
string
>

IDs of tags the post is tagged with.

title
string

Post title.

translationId
string

ID of the post's translations when Wix Multilingual is installed on a site. All translations of a single post will share the same translationId.

url
string

Post URL.

Was this helpful?

Get items from a query result

Copy Code
1const returnedItems = results.items;
2
Perform a query and get items from the result

Copy Code
1import { posts } from 'wix-blog-backend';
2
3export async function myQueryFunction() {
4 const results = await posts.queryPosts().find();
5
6 const returnedItems = results.items;
7
8 if (returnedItems.length > 0) {
9 return items;
10 } else {
11 // Handle if no matching items found
12 }
13}
14