my client has a blog with a lot of content. It’s all been nicely tagged with topics.
In the built in topic filter, the logic is AND based (i.e. show me posts with Topic A AND Topic B). What I’m after is topic filtering that is OR based (i.e. show me posts with Topic A OR Topic B).
I’ve googled, and seen A(un)I summaries that suggested creating a custom module type that doesn’t even exist, along with piecemeal ideas that don’t quite work (or that I can’t understand - equally probable).
Hi @Jopitts and thank you for asking the HubSpot Community!
- Is your blog built using standard HubSpot blog templates, or do you have access to custom coded templates/modules?
- Are you comfortable editing HubL code, or do you prefer low-code/no-code solutions?
- Have you considered using HubDB or dynamic pages to power your blog listing?
I’d love to put you in touch with our Top Experts: Hi @sylvain_tirreau, @Anton and @SteveHTM do you have suggestions to help @Jopitts, please?
Have a lovely day and thanks so much!
Bérangère
I’m very happy coding to get the right outcome, if that’s the best way.
As best I can tell, the blog listing page is using a custom piece of code. However, the standard filters can still be dragged into the page and deleted from the page.
To make sure you get the best guidance, I’d love to bring some of our Top Experts into the conversation. Hi @mehdi, @EddBrisley and @kosalaindrasiri do you have any tips or solutions you can share to help @Jopitts with this?
Thanks so much, everyone, for your collaboration! Wishing you all a great weekend ahead.
Bérangère
@BérangèreL , thanks for trying to help. I’m pretty disappointed that no one has replyed other than you. I guess I’ll bash my head against the brick wall and see which one breaks first
You need to give me more details about what you want to do. You’re talking about dynamically selecting topics: do you mean that on the listing page, you’ll provide the option to choose topics (if there are several, they’ll be checkboxes, right?), and once these topics are chosen, you only want to display on the listing page the posts that correspond to the chosen topics?
If that’s what you want to do, you need to adopt a different approach.
If not, explain to me what exactly you want to do.
I’m working with a FWDS theme. I 100% get your logic, but I’m trying to work out where the code would sit.
Additionally, given the topics are dynamically selected, adding them to static lists as you’ve shown at the top of your code won’t work. I was pondering merging the get of posts for a topic and the loop that gets the unique posts.
i.e. loop through selected topics. Get posts per topic. Add to ‘output’ list, if they aren’t already there.
That logic is all well and good.. BUT how do I loop through the selected topics? I am learning, slowly - so thanks for both your help and patience!