I'm using Drupal 7 as a document management system and I've got a taxonomy vocabulary called "Document Tags" with the following structure:

  Best Practices
  Client 1
  Client 2
Office Management
   Org Charts

I created a block view using Views Tree and set up the tree structure that works well so that the categories are nested and expand properly, and are each linked like so:


My document view uses the contextual filter "Content: Has taxonomy term ID" and then in the filter as shown. When I click on a first level category (Accounting, HR, IT, Office Management, etc.) it works great but anything underneath only displays the documents tagged with the top level, so it's evidently only using the first parameter in the display.

Is there a way to have the filter always pull the last URL parameter (e.g. "forms" in the URL mysite.com/docs/hr/forms)?

UPDATED - here are screenshots of the two pages and their results: http://tentenstudios.com/storage/page_1_filter.png http://tentenstudios.com/storage/page_1_results.png http://tentenstudios.com/storage/page_2_filter.png http://tentenstudios.com/storage/page_2_results.png

1 Answer 1


Yes, you can add a separate block with the same settings and in the contextual filter get form from the url.

Add the blocks in the same region and in the visibility settings select Only the listed pages and add docs/*/* for child terms and to the other block add docs/* for the parent terms.


If you have a Taxonomy type page view then you can do the following thing.

Create and set page view

Create tow pages with path as docs/* for parent terms and docs// for child terms i.e. form.

In the contextual filter add term id and select This Page override. and check Provide default value. In the Type drop-down select Raw value from URL and then from Path select 3 for docs/%/% path and 2 for docs/% path.

Cotextual filter changes.

  • I'm not sure I follow - the documents view is a page view, not a block view (with the URL mysite.com/docs) and if I duplicate the view I don't get how to target just the last parameter. The block view which displays the directory tree works great. Oct 5, 2017 at 13:45
  • what is the path for you assigned to this page view. I suppose it is docs/%.
    – Shrikant D
    Oct 6, 2017 at 5:05
  • I am assuming the path for your site is mysite.com
    – Shrikant D
    Oct 6, 2017 at 5:44
  • Thanks for the update - unfortunately after making that change the result is the same. I created multiple page views, the first being docs/%, then docs/%/% and set the parameters as described. When I browse to mysite.com/docs/accounting (for example) I get the appropriate results. When I browse to mysite.com/docs/accounting/client I still get everything from the first query. Oct 9, 2017 at 18:23
  • Did you checked the overriden dropdown in contextual filters for both views. It shoud say This Page(Override) instead of All Display. Try to check the page with term id as docs/[term_id_for_accounting]/[term_id_for_client]. It should work. After making these changes please make sure to clear drupal cache.
    – Shrikant D
    Oct 10, 2017 at 9:32

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.