I'm hoping someone could please help me tame the beast that is known as contextual filters. :) I have a series of nodes that all have a specific taxonomy term assigned to them (all from the same vocab), but for my url path I do not include those:

For example:

Vocabulary name = videos

A node has terms:


assigned to it, but the only url that I want is:


And then all other nodes which have terms on them will all be under the 'videos' directory:


I created a view that has a contextual filter where I want to display only the nodes that have the carrot term. And it that works perfectly when previewed on the views page, but when loading up the actual page I get a listing of ALL the nodes under the "food" term because I have "WHEN THE FILTER VALUE IS NOT IN THE URL --> Display all results for the specified field"

My main problem I think is that "The contextual filter values is provided by the URL." And my terms are not in the url. So somehow I need to pull the terms associated with each node.

Any help would be much appreciated!

  • how are you defining the urls? and what is the view path you are using Jan 19, 2013 at 5:44
  • @MohammedShameem - My view path is /food. If I were to go to /food/carrot then it works just fine. But I need the url to be /food/title-of-node. My goal is to have all my nodes be under the 'food' term. I'm not sure what you mean by defining the urls? Hope that helps!
    – Dan
    Jan 19, 2013 at 5:55
  • so do you want to filter the node depending on the words in the title of the node? or the terms that the node is associated with? Jan 19, 2013 at 5:56
  • The terms would be perfect! So as in my example if i have 10 videos with the term carrot then all 10 would show. But, my url has to be /food/title-of-each-carrot-node. i hope that makes sense.
    – Dan
    Jan 19, 2013 at 6:19
  • and does the node have multiple terms associated with it or a single term? Jan 19, 2013 at 6:27

1 Answer 1


Instead of creating a node view create a taxonomy view.

In that provide two relationships:

  1. Taxonomy term: Content with term;
  2. Taxonomy term: Content using {Name of the taxonomy field in the content type}*;
  3. Add a contextual filter of the type Content : Title; Use the first relationship for the contextual filter, Make necessary changes in the more option such as change to lower case turn space to dashes etc;
  4. Add the required fields from the content with the relationship set to 2);

You are good to go.

EDIT : As per the discussion There was another need to also show the nodes under a term and its sub terms.

  1. Create a view of the type content;

  2. Add the required fields;

  3. Add a contextual filter of the type Content: Has taxonomy term ID (with depth) and select the depth a value as deep as the hierarchy you have in the taxonomy.

Now when you pass the term id as the input it would show all the nodes under that taxonomy term including the child nodes.

If you wish to change the url to have the term name instead of the term ID Do the following.

  1. In view give the path as taxonomy/term/% this will override the default taxonomy path;

  2. Install Pathauto Module this depends on Tokens module so have to install that as well;

  3. In Configuration -> URL aliases you have a tab called Patters;

  4. Set the pattern of the "TAXONOMY TERM PATHS" to what you would like it to be. Make sure that the last value is [term:name] so if you want the path to be category/carrot you should give it as category/[term:name];

  5. If you have already added the taxonomy terms then you would need to do the "BULK UPDATE" which is again a tab on the URL Alias page.

Now when you visit the page category/termname you will see all the nodes under the term including the child terms.

  • Thanks Mohammed! I'll give that a try. Can you direct me how to create a taxonomy view please. I can then take it from there. Thanks!
    – Dan
    Jan 19, 2013 at 7:19
  • When you create a view there is a dropdown that says "show" which would we selected to content. Change that to taxonomy. Jan 19, 2013 at 7:25
  • Mohammed I do not see a "Content using {Vocab name}" as an option. I only see content using catalog, category, keyword, tags, term. Am I missing something?
    – Dan
    Jan 19, 2013 at 16:17
  • I mean you should replace the vocabulary name that you have :-) sorry for not being clear. will update my answer to make it more clear. so if it is category then it should be Content using category etc... Jan 19, 2013 at 16:21
  • Ah ok. :) Makes sense. Unfortunately I don't see my vocab named "food" listed as one. Do I need to reference it somewhere else to see it?
    – Dan
    Jan 19, 2013 at 16:29

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.