Working with Cascade filters and taxonomies

Is there anybody who has knowledge of working with the Cascade Filter Plugin? I am new to taxonomies and I do not get a lot wiser from the readme or from the official Grav documentation…

Don’t expect any answers when there’s no real question asked. Asking if someone knows some specific thing will never get you prompt responses in forums. Tell what’s wrong and ask what you want/need/expect to achieve.

1 Like

Ok, you are right of course. I need to know what exactly to write in the frontmatter of the blog page and on the item pages to get this Cascade Filter showing the taxonomy categories and their values. I now have on the item pages for instance the following:

---
title: Webinar 2
theme: casual
taxonomy:
    Thema: BI & Data Science
    Taal: Nederlands
    Applicatie: Excel
    Startdatum: 01-08-2021
    Functionalieit: Geen idee
---
#webinar 2

But nothing of that shows…

@TonHaarmans,

  • What more have you done and tried to get it working? I presume the plugin needs a bit more then a taxonomy variable in frontmatter. I can think of:
    • Changing the site.yaml
    • Adding a bit of code to a template
    • Configuration of the plugin itself
  • Does the README mention any steps to follow?
  • Do you get any errors?
  • “But nothing of that shows…”
    What did you expect to be shown?

Yes, I have configured the plugin and added taxonomy types. I also added the necessary template code. I don’t know what to do with site.yaml. Should I have there the same taxonomy types as in the plugin configuration?
The goals is to show the values of the categories in the blog items and also the possibility to filter on these categories and values, like it shows in the readme of the plugin:

Which template did you add the code to? Do you get any errors? What’s the result of your attempt (it should show at least something)?

I use a customized template, derived from X-Corporation. I don’t get any errors. The result shows as follows:

The live site is at Webinars landing page | Bit By Bit Software Coaching
If needed I can give you access to the Admin…

@TonHaarmans, We are already on post #9 and so far only questions have been asked by the community. Questions to get insight about the steps you’ve taken and how exactly the plugin has been configured.

These questions are asked to shed light in the dark necessary to pinpoint possible errors made during setup, or to be able to replay each step to setup the plugin on a local machine.

Please help the community help you, by asking a clear question with relevant information in a concise and succinct manner.

Yes, I have configured the plugin and added taxonomy types

  • How does the config of the plugin look like?
  • How/where have you added taxonomy types? How does it look like?

I also added the necessary template code.

  • What have you added?
  • Where did you add the code?

I don’t know what to do with site.yaml.

  • So what did you do with it?

The result shows as follows:

  • An image of a page with an empty slot for a plugin doesn’t provide much info…

If needed I can give you access to the Admin

  • File based info is all that’s needed in Grav. It’s a file based CMS after all…

Sorry I have been so stupid. I thought the information I gave would be enough. Ok, I give you all the info:

Config plugin Cascade Filters:

enabled: true
select_pages:
  - /landing/webinar-1
  - /landing/webinar-2
taxonomy_filters:
  - Thema
  - Taal
  - Applicatie
  - Startdatum
  - Functionaliteit

So, that’s also where I added taxonomy types. I have also tried to give the blog page as value for select_pages. but that doesn’t do much either.
The code I have added to sidebar.html.twig (which is part of blog.html.twig):

{% import 'partials/cascade-filters.html.twig' as f %}
<div class="sidebar column is-narrow">
	{% set taxlist = cascadeFilters.get() %} {# get texonomy list #}
	{% set queries = uri.query(null, true) %} {# get queries as Array #}
	<a href="{{ page.url }}" class="button">Clean all filters </a>
	{% if taxlist %}
		{% for key, values in taxlist %}
			<p>
				{{ key }}
			</p>
			<ul class="is-clearfix">
				{% for tax in values|keys %}
					<li style="float: left; margin: 5px">
						{{ f.genQueryUrl(queries|sort,key,tax, page.url, cascadeFilters) }}
					</li>
				{% endfor %}
			</ul>
		{% endfor %}
	{% endif %}
</div>

I did nothing with site.yaml

I hope this is enough information. Thank you for your patience.

@TonHaarmans,

First some remarks on the plugin itself:

  • It is released in May 2017 and never touched since.
  • It provides no ‘issue’ page for asking questions.
  • Plugin throws exception with default setup.

Above are reasons enough for me to run from it…

Further:

  • Plugin links have wrong urls when applied on page with url ‘/’.
    You’re just lucky, because you don’t hide the default language extension.
  • It uses code that has been deprecated since Grav 1.4. When removed in a future release of Grav, plugin will fail.

Considering the above I am reluctant to spend more time on this plugin. But will share what I’ve already found in case you’re curious…

Further findings if curious only
  • The following ‘button’ is shown on your page: Clean all filters
    Which means:
    • The plugin is shown on the page
    • The code {% if taxlist %} returns false, because taxlist is empty.
      • select_pages: is an array pointing to pages that list collections of blog items, NOT the blog items themselves.
      • I did nothing with site.yaml

        • Taxonomies need to be added to ‘site.yaml’.
          Please read the docs on Taxonomies again. Grav will only collect pages which are ‘labelled’ with taxonomies available in site.yaml

Ok, thanks a lot, also for your patience. Yes, I saw that too that the plugin is old and has not been updated. The point is, my client needs a site with layered filtering AND I would love to use GRAV for that. If this can be done with another plugin, that would be great. If there is no other plugin that can do this, then perhaps one should be written and I need a programmer who can do that. My client is probably willing to pay for this, depending of course on the costs… Any idea how to proceed with that? I already emailed the person who made the plugin i am using now.

BTW, your suggestion to add the taxonomy also to site.yaml worked brilliantly. The filters are shown, but clicking on a value that is not shared between the two items anyway shows both items… Also: clicking on a category value should bring up only the items which have this value. But nothing happens.

Somebody programmed it. https://flatfiledeveloper.com/