Question:
How do I filter my dataset to match the tags of each blog article?
Product:
Wix Studio Editor
What are you trying to achieve:
I want my blogs to display related products based on the tags.
For example, I have a blog about London and want to show London properties for sale in a repeater component under the article.
What have you already tried:
Tried YouTube.
Additional information:
Create a dataset and set its filter accordingly, it should allow you to compare with the other, existing dataset
Hi Dean, How do I filter the dataset to the blog tags?
I’m facing the same issue, and don’t know what to do…
Have you solved it yet?
Greetings guys
I hope all is well
On my site, I have a repeater that show a bunch of video game data based on the ‘tags’ associated with that game (i.e. someone can click a dropdown box and choose ‘playstation’ and all the playstation games will show up, or ‘xbox’ or whatever’.
I think you can use my code below and modify it to show blogs based on your tags
//Function to filter repater based on tags
function dropDownSearch()
{
const selectedTag = $w('#gamingDropdown').value;
let filter = wixData.filter();
if (selectedTag.length > 0)
{
filter = filter.hasSome("gameSystems", selectedTag);
$w('#createPollCollection').setFilter(filter);
}
if (selectedTag == "all")
{
$w('#createPollCollection').setFilter(wixData.filter());
}
}
Now on my site, the function above is called when someone change a dropdown but you can call your function any way you want (i…e when someone click a button to filter the blogs based on tags).
Key thing to know
let filter = wixData.filter()
filter = filter.hasSome(“<fieldinyourcollection_withtags>” , “tagtolookfor(i.e. blogs on food)”
Hope this helps guys
Good luck
SkreenGG