I’ve created a custom blog landing page, with the default Posts dataset that is filtered by featured posts.
I’ve connected this data to a strip and it’s background, as well as to a text element for the title.
I tested it in the editor, but since publishing it seems very temporamental - sometimes loading the featured post as the background image, and sometimes not.
In addition, I’ve created a custom blog article page and this is doing the same thing, but with custom code pulling from the default blog article (ID: #posts1)
Same thing is happening here - sometimes this data comes in, other times it doesn’t.
Really not sure what is causing this, as most of the time it works, but if you refresh several times in a row it will break on one of the refreshes.
Below is the code being used on the blog page itself. It’s pretty basic - just querying the default Wix posts widget (#posts1) for its cover image and title, then applying this a strip and text element at the top of the page.
$w.onReady(function () {
$w('#post1').getPost()
.then( (post) => {
let postTitle = post.title;
let postImage = post.coverImage;
$w('#postHeaderStrip').background.src = postImage
$w('#postTitle').text = postTitle
} );
})
Any help would be greatly appreciated.