How can I create a view page that takes taxonomy machine name and has depth? This question is a followup to How to load nodes that are associated with the child of a taxonomy term and refers to this answer in particular, but is standalone, so you need only visit those if you want more background.

I want to create a view that functions like the Taxonomy term view that comes with views with depth turned on in the contextual filter, but taking the term's machine name instead of tid as the contextual argument.



I have pathauto set up to alias /taxonomy/term/tid to /vocabulary/term, and I would like to override the page there with views to make it show nodes associated with the children of the term as well as the parent.

So if I had the following Taxonomy:

Vocabulary 1 (vocab_1)


Term 1 (term_1)


Term 2 (term_2)
Term 3 (term_3)

Term 4 (term_4)


Term 5 (term_5)



and nodes as follows:

Node 1 - Term 2, Term 5
Node 2 - Term 5
Node 3 - Term 3

A visitor to /vocab_1/term_1 should get a list that contains nodes 1 and 3 because they are associate with children of Term 1.

I haven't been able to figure out how to do that with the term machine_name as the contextual filter instead of the tid.
You can use the contextual filter Content: Has taxonomy term ID (with depth) without adding a Relationship.  Use this settings for the contextual filter:

When the filter value is NOT available: Provide default value 
Type: Taxonomy Term ID from URL
Make sure Load default filter from term page is checked.

Please note: When you visit a pathauto destination path, in this case with a source of /taxonomy/term/% pointing at /vocabulary_name/term_name, drupal passes the source path as a query variable, and your view still uses the source path to gather information.  This means your path in the view should not change, it should stay as taxonomy/term/%