Streaming live at 10am (PST)

Dynamic blog post with dynamic category filter

Hello
Any help would be appreciated
Currently I’m working on a blog page project which has different categories. Both category and blog post are dynamic. But I want category as filter. Suppose when a visitor click on a certain category the page will only show that category related post. I know it can done through conditional visibility but i don’t know how to make that happen. Can anyone help me with this ?
Any video tutorial would be a great help for me
Thanks in advance

Hi @ahmedsani355,

Remember that filtering is also loading a new page, so you can create a menu of CMS categories that will link to each category template.

Inside the template, filter the blogs to belong to the “current category” and place the same menu inside the page. This will create a filter by category.

Let me know if it helps

Can you provide me a video tutorial ? It will be a great help for me

Hi ahmedsani355! If you just want a simple way to filter your blog posts by category I would suggest that you create a reference field in your blog post collection and link every post to a category. You can also use a multi-reference field if you need to connect a post to several categories.

When that is done, you can go to the category collection page and add a collection list with your blog posts. Go to the element settings (shortcut “D”) and add a filter (“reference field name” equals “current category”).

To create the filter links you add another collection list and connect it to your categories. Then you can place a link inside the collection list and set it to dynamically display the name of the category and link to that category page.

Check out the links below for more information on reference fields:


I would also encourage you to check out the Finsweet CMS-library and use it for the filtering! It is really powerful and could solve your problem while also adding more advanced filtering if you wish, but it does require you to copy and paste some code into your project. Check it out here: https://cmsdocs.webflow.io/#filter.

What do we do when “Current Category” is mysteriously missing from the drop-down filter? This is terribly frustrating.

Hi!

“Current category” will only show if you have placed the collection list on a category template page:)

1 Like

Thank you for your response! I did figure that out eventually. One final question: What is the best way to link to a collection page from a static page? The only way I’ve found is to wait until the site is live, and assign a url to a link/button.

Is this correct?

Thank you!

Joseph

@Two_Wolves_Creative
There are two ways to do it:

The first one is copying the page URL directly as you have already done. The other is to add a collection list with a filter so that it only displays the item you want to link to and then add a link block of text link inside it and link it to the “current item”.

Unfortunately, I don’t think there are other ways to do it:(

1 Like

Thank you! The second option works just fine for our purposes. Huge help!

Hi @Johanfelix,

I’m having a bit of trouble figuring out the categories filter on our website.

I’ve added the three filters as categories in CMS and have linked each blog post to their corresponding categories, however when I try to find the categories in the dropdown, they don’t appear.

Thank you for your help!

Hello,
Check the below-mentioned link for a Youtube video.
I hope it will help you out.
/watch?v=U3A4_LZ4hU4

Getting text from categories isn’t the same as sorting/filtering on category.

Just create a bunch of text field where you’ve written in the category names, then apply conditional visibility to the respective text field for each category :slight_smile:

Hi @Publift

Sorry for the late response… I checked your link and it seems like you have figured it out? Let me know if this is still an issue!

Hey @Johanfelix!

You’re right, it looks like it works! That’s strange because I didn’t change anything.

Anyhow thanks so much for your response!

Fatima