0

I'm working on a sulu project (I think it is currently on 1.3) and using its smart content feature to display teaser lists. What I would like to achieve now is to make these lists user filterable [edit: website user, not content manager] e.g. by tag, a bit like the Drupal Views' exposed filter feature. Did I miss something or does it simply not exist in the Sulu world? I don't need any advanced search backend as in the SuluSearchBundle, a way for the user to edit the filtered tags would be completely sufficient for the moment.

Thanks in advance and best regards

Sören

S. Parton
  • 73
  • 1
  • 7

1 Answers1

1

That's a built-in feature in Sulu, the content manager can decide how to filter the smart content, based on e.g. tags & categories. When you click on the configuration button for the smart content you see a overlay like this: enter image description here

On the autocomplete for "Filter by tags" you can enter by which tag the smart content should be filtered.

UPDATE 2017-06-14:

You can also let the user filter for tags, that's what the tags_parameter parameter in the template configuration is for:

        <property name="smartcontent" type="smart_content">
        <meta>
            <title lang="de">Smart-Content</title>
            <title lang="en">Smart-Content</title>
        </meta>

        <params>
            <param name="tags_parameter" value="tags"/>
            <param name="properties" type="collection">
                <param name="title" value="title"/>
                <param name="article" value="article"/>
                <param name="ext_title" value="excerpt.title"/>
                <param name="ext_tags" value="excerpt.tags"/>
                <param name="ext_images" value="excerpt.images"/>
            </param>
        </params>
    </property>

Now you can append something like ?tags=tag1,tag2to the URL and the content will be further filtered.

Daniel Rotter
  • 1,998
  • 2
  • 16
  • 33
  • Sorry, It seems I wasn't clear enough. I would like the website user to be able to determine the tag, not the content manager. That's how e.g. Drupal Exposed Filters work. – S. Parton Jun 13 '17 at 11:34
  • Yay, that's what I wanted to know. Thank you. – S. Parton Jun 14 '17 at 12:10
  • @daniel-rotter In addition to filtering by tags, I also need to filter pages by date. Can you help me to find best way to do this? – Олег Нечаев Feb 18 '20 at 15:33
  • @ОлегНечаев You can only sort by dates, you cannot filter by them using the Smart Content... If you want to build something like that, you have to do that somehow on your own (the easiest way might be to create an own controller by replacing the `controller` tag: https://docs.sulu.io/en/2.0/book/twig.html#which-twig-template-is-used) – Daniel Rotter Feb 19 '20 at 08:15