Custom Blog Post Info

I ran into a similar problem, and found a number of other posts stating the same. Solved for it with the following code, which should work in the instance of customizing elements (Banners, Images, Titles, Text etc.) on a Blog Post Page:

*Just make sure to update the $w(#ElementID) with the ones you have defined on your page, ie. $w ( #Banner )

import wixLocation from ‘wix-location’ ;

let currentPost

$w . onReady ( function () {

wixLocation . onChange (( location ) => { 
    initPage () 
}); 

initPage () 

})

async function initPage ( ) {

$w ( "#post1" ). getPost (). then ( **async**  post  => { 
    currentPost  =  post ; 
    assignPostDataToUIElements () 
}); 

}

function assignPostDataToUIElements ( ) {
console . log ( currentPost )
$w ( “#Banner” ). background . src = currentPost . coverImage
$w ( “#MainTitle” ). text = currentPost . title
$w ( “#Headline” ). text = currentPost . excerpt
$w ( “#ReadTime” ). text = currentPost . timeToRead
$w ( “#ViewCount” ). text = currentPost . viewCount
}