I have a non-hierarchical taxonomy and 2 content types.

I need to make these pages with Views:

(This will display nodes of content type A that are tagged with termA.)

(This will display nodes of content type B that are tagged with termA.)

(This will display nodes of content type A that are tagged with termA.)

(This will display nodes of content type B that are tagged with termB.)

In actual fact there are a lot of terms so I need these pages to be from 1 or 2 Views (EG with dynamic filters). I cant just make 4 Views with static filters.

I could create 2 Views, one for each content type. Filtering by the content type is simple so my issue is just that I need to figure out how to filter by a term when you are on a sub page of that term, not on the term's page itself.

Eg filtering by termA on this page is easy: 

But how do you filter by termA when on this page?

2 Answers 2


I'm a little confuse on what you're trying to show but I think you can do what you want with contextual filters.

To do so:

  • Add taxonomy to the filter critera (Has taxonomy term ID)
  • In the first section (when not available), select Provide default value
  • Type : Raw Value from URL
  • Select your path component (let say 2 for your term1, categories would be 1)
  • In the "When the filter value IS available or a default is provided" section, check "Specify validation criteria"
  • Validator : Taxonomy
  • Check the appropriate vocabulatory
  • Filter value type : Term name converted to ID

What that filter will do is check a part of the url and match it against the vocabulary. If a term is matched, let say term1, it will show nodes that have the term. You can add multiple filter to validate multiple part of the url. It's pretty much the same for the content types.

So /term1 could filter all node with term1. term1/activities could filter all term1&activities... You get the idea. Just don't hide the view if the filter doesn't validate, make it show all results.

  • When you say "Add taxonomy to the filter criteria (Has taxonomy term ID)" do you mean Contextual filers not the normal filters?
    – Evanss
    Apr 23, 2015 at 13:29
  • In my example "activities" is a static value. It is not a term. Nodes will never be tagged with more than 1 term from this vocabulary.
    – Evanss
    Apr 23, 2015 at 16:03
  • The depth modifier for the contextual filter seems to only work with hierarchical taxonomies.
    – Evanss
    Apr 23, 2015 at 16:08
  • Ive updated my question to make it clearer
    – Evanss
    Apr 23, 2015 at 16:28

This can be done by adding a module.

First clone the default View "Taxonomy term". Then add a page displays which use the default term URL followed by whatever the sub page needs to be eg taxonomy/term/%/ContentTypeA. On this page I can filter by the content type.

Now the page will work at this URL: /taxonomy/term/1/ContentTypeA

However it wont work with the Pathauto path that ive previously set for the term page. EG this wont work: /something/termA/ContentTypeA

To make Pathauto recognize the URL you just need to install the Sub Pathauto module: https://www.drupal.org/project/subpathauto

Credit to @Paul Querol who helped me out here: Views contextual filter not working for Pathauto path

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.