getPost( )
Gets the all the information associated with the current blog post.
Description
The getPost()
function returns a Promise that is resolved when all
of the information about the post shown on the PostPage
is
retrieved.
Syntax
function getPost(): Promise<BlogPost>
getPost Parameters
This function does not take any parameters.
Returns
Fulfilled - When the information associated with the current post has been retrieved.
Return Type:
NAME
TYPE
DESCRIPTION
Post ID.
Post title.
Text of the post.
Date the post was originally published.
Number of times the post was viewed.
Number of likes the post received.
Number of comments the post received.
Date the post was most recently published.
Indicates whether the cover image is displayed in the post.
Estimated time in minutes required to read the post.
Indicates whether the post was pinned to the top of the blog feed.
Indicates whether the post is set as featured in the post settings. Featured posts appear in custom blog feeds.
List of all hashtags in the post.
Relative URL of the post page on your published site.
A few lines of text that appear in the blog feed. Defined in Post Settings or default of first 160 characters of the post.
Was this helpful?
Get the current blog post's information
1$w('#myPostPage').getPost()2 .then( (post) => {3 let postTitle = post.title;4 let postContent = post.plainContent;5 let postImage = post.coverImage;6 // see example post object below7 } )8 .catch( (error) => {9 console.log(error);10 } );1112/*13 * Example post object:14 *15 * {16 * "_id": "5ccfd8c7b423c208e841dbbd",17 * "title": "My Blog Post",18 * "plainContent": "When it comes to design, the Wix blog has everything you need to create beautiful posts that will grab your reader's attention. You can add whatever tags you want (#vacation #dream #summer) throughout your posts to reach more people.",19 * "publishedDate": "2019-05-06T09:11:33.622Z",20 * "viewCount": 37,21 * "likeCount": 8,22 * "commentCount": 3,23 * "lastPublishedDate": "2019-05-08T11:54:26.214Z",24 * "coverImageDisplayed": true,25 * "timeToRead": 1,26 * "pinned": "false",27 * "featured": "true",28 * "hashtags": [29 * 0: "vacation",30 * 1: "dream",31 * 2: "summer"32 * ],33 * "coverImage": "wix:image://v1/22cf07_256ac11eaf6548e0b2bb2fc3ede561ff~mv2.png/466_363...",34 * "postPageUrl: "/post/my-blog-post",35 * "excerpt": "When it comes to design, the Wix blog has everything you need to create beautiful posts that will grab your reader's attention. You can add whatever tags you want..."36 * }37 */