Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mark Pickard 23 posts 115 karma points
    Oct 29, 2020 @ 12:38
    Mark Pickard
    0

    Build a dropdown filter for posts - any help?

    Hi all,

    First post! I'm developing our vehicle website on Umbraco 8 (v8.8.0). My task is to take our wordpress site and rebuild it in Umbraco. I have developed a couple of sites in Umbraco already and comfortable with most of it but this part I am trying to find the best solution.

    Does anyone have any suggestions on how I can create a filter page with dropdowns (or checkboxes) that will display the child items in the page as you change the filters as per my screenshot?

    None of my child items on the feed pages have any category tags yet. I have looked everywhere for an example of even a blog with sidebar that you can filter by cat tags but I cannot find much. The closest thing I have found is the demo on uvendia but as the site is almost complete I am unsure about installing uvendia and having to rebuild all my pages. I also saw Bobo Facets but think it may be out of date for Umbraco 8.

    Could someone give me some pointers please?enter image description here

  • Mark Pickard 23 posts 115 karma points
    Nov 10, 2020 @ 12:26
    Mark Pickard
    0

    Just to update... my vehicles (or articles) all have basic tags now eg. Diesel, Vauxhall under "postTags" Eventually I will put Diesel, Petrol under "fuelTags" and Vauxhall, Renault under "modelTags" for example. It's just the how I implement the checkboxes or dropdowns to render those posts chosen.

    So far I have tested a hard coded search for the Diesel tag and it successfully pulls back the 2 vans with Diesel but I need pointers on how to implement the tags into checkboxes or dropdowns. Would I need AJAX? Could I use Umbraco forms to assist with this? Here is my hard coded part before I render the 2 results...

    @if (Model.FeedPage != null)
    {
        Feed FeedPage = Model.FeedPage as Feed;
        var posts = Model.FeedPage.Children<Post>().Where(x => x.IsVisible() && x.Value<DateTime>("date") < DateTime.Now).OrderByDescending(x => x.Date).ToList();
    
    
        <div class="block__body">
    
    
            <div class="row row--center row--no-wrap-s box-wrap">
    
    
                @foreach (var post in posts)
    
                {
    
    
    
                    if (post.PostTags.Contains("Diesel"))
                    {
    
  • Paul Seal 428 posts 2354 karma points MVP 3x c-trib
    Nov 10, 2020 @ 13:47
    Paul Seal
    2

    Hi Mark

    This reply is for anyone who didn't see it on Twitter, I replied with this github repo link which might help with this.

    https://github.com/callumbwhyte/examine-facets

    Good luck with getting it working.

    Kind regards

    Paul

  • Mark Pickard 23 posts 115 karma points
    Nov 10, 2020 @ 13:52
    Mark Pickard
    0

    Thanks Paul! I look forward to your mini-series on this subject

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies