Taxonomy Views Browser of Arbitrary Depth

Here’s a way to create a View (Drupal 7, Views 3.x) that lets you browse an arbitrarily-deep taxonomy hierarchy. With this type of browser you can link, oh, say, a large collection of videos, or photo galleries, or any kind of huge list of content categorized in a nested tree.

First, an simple static taxonomy term browser:

Static Depth Browser

This will give you nice paths and breadcrumbs (e.g. vocab » parent » term) For a taxonomy of static depth, you would do the following:

  1. Create a view of nodes
  2. Add relationship to taxonomy term (Term)
  3. Add relationship to taxonomy term parent, accessible via Term (Parent)
  4. Add relationship to taxonomy term parent, accessible via Parent (Parent Parent)
  5. Repeat step 4 as many times as necessary for your taxonomy’s depth.
  6. Add contextual filters for each one and make sure they’re in the proper order. Set to display a summary when filter is not in URL.
  7. You’ll probably want to override the breadcrumb and title for each filter.

Variable Depth Browser

For a taxonomy of variable depth, it’s a bit more complex:

  1. Put add a new top-level term (Foo) to your vocabulary and put all other terms under it.
  2. Create a view of terms with a page that displays term names
  3. Add contextual filter: Taxonomy term: Parent term
  4. When the default value is not in the URL, provide default value
  5. Set default value to your top-level term name (Foo)
  6. Specify validation criteria
    • Validator: taxonomy term
    • Criteria: your vocabulary name
    • Filter value type: Term name converted to term ID
  7. Click the “+Add” button at the top of the Views panel to add an Attachment to the view.
  8. Add to this attachment only (override) Relationship: Taxonomy term: Content with term
  9. Add to this attachment only (override) display: fields: node titles linked to nodes, and remove (from this attachment only!) display: fields: term name
  10. Add to this attachment only (override) contextual filter: Taxonomy term: Name
  11. When filter value is not available, provide default value: Raw value from URL: Path component: 2 (or more if your Page path has >1 component)
  12. Attachment settings: Attach to: [name of the page display you just made]

It’s not perfect — it doesn’t generate a nice URL and breadcrumb with the taxonomy lineage the way that my solution for a taxonomy of a single depth would do. The Path Breadcrumbs module is the tool you’ll want to use for this.


Cross-posted on Drupal Stack Exchange.