What I want:
When I navigate to a page... Of a certain Content Type... which is tagged with a Term... I want a Block created via Views should generate a list of pages with that Term.

I've adjusted my setup to key off of Articles with a Taxonomy: Sports and Terms: Golf, Hockey, Etc.

I have a Content Type "Article" with the fields (amoungst others):

Portal (Term - Singular term allowed)

I have a Views Taxonomy filter setup such that given a context of a Term, it should filter into a list of pages that have that Term (Code at bottom of question) ...

It works when setup as a page, and in the "Preview" section (As shown in the picture). It doesn't work when moved into an block. enter image description here

What's showing:
Notice the "Sports: Golf" yet the Sports List shows ALL portal pages (Not filtered). The Article is tagged, but the list isn't getting the "context". If I was to scroll down, all "Sports Pages" would be shown, but I only want those listed in the given context (golf in this example). Demo

It's mentioned to use "Taxonomy ID By URL"... this doesn't work. There is no "Taxonomy" in the URL - Either stock node/# or via URL Alias myip/portal/safety/home (pathauto alias that has the term NAME in it... but not the ID. portal/8/home isn't very "pretty" and I'm not sure that would work either, although I may try)

Okay... I adjusted the auto alias via pathauto... making it portal/8/home ([node:term:vocabulary]/[node:tid]/[node:title]) still doesn't work. that Alias points to node/# and that still doesn't resolve into a "Term via URL" since there is no term in the URL.

Various attempts to make a relationship have been unsuccessful as well.

I don't want to go to "Content Type as a Term" - where each Portal has it's own content type - but at this point... if I want to move forward I may have too.

View Export

$view = new view;
$view->name = 'content';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Content';
$view->core = 7;
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Portal List';
$handler->display->display_options['use_ajax'] = TRUE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'title' => 'title',
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'title' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
$handler->display->display_options['style_options']['override'] = 1;
$handler->display->display_options['style_options']['sticky'] = 0;
$handler->display->display_options['style_options']['empty_table'] = 0;
$handler->display->display_options['exposed_block'] = TRUE;
/* Field: Taxonomy: Term */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'taxonomy_term_data';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['name']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['name']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['name']['alter']['external'] = 0;
$handler->display->display_options['fields']['name']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim'] = 0;
$handler->display->display_options['fields']['name']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['name']['alter']['html'] = 0;
$handler->display->display_options['fields']['name']['element_label_colon'] = 0;
$handler->display->display_options['fields']['name']['element_default_classes'] = 1;
$handler->display->display_options['fields']['name']['hide_empty'] = 0;
$handler->display->display_options['fields']['name']['empty_zero'] = 0;
$handler->display->display_options['fields']['name']['link_to_taxonomy'] = 0;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Sort criterion: Taxonomy: Term */
$handler->display->display_options['sorts']['name']['id'] = 'name';
$handler->display->display_options['sorts']['name']['table'] = 'taxonomy_term_data';
$handler->display->display_options['sorts']['name']['field'] = 'name';
/* Sort criterion: Content: Title */
$handler->display->display_options['sorts']['title']['id'] = 'title';
$handler->display->display_options['sorts']['title']['table'] = 'node';
$handler->display->display_options['sorts']['title']['field'] = 'title';
/* Contextual filter: Taxonomy: Term */
$handler->display->display_options['arguments']['name']['id'] = 'name';
$handler->display->display_options['arguments']['name']['table'] = 'taxonomy_term_data';
$handler->display->display_options['arguments']['name']['field'] = 'name';
$handler->display->display_options['arguments']['name']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['name']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['name']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['name']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['name']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['name']['glossary'] = 0;
$handler->display->display_options['arguments']['name']['limit'] = '0';
$handler->display->display_options['arguments']['name']['transform_dash'] = 0;
$handler->display->display_options['arguments']['name']['break_phrase'] = 0;
$handler->display->display_options['arguments']['name']['add_table'] = 0;
$handler->display->display_options['arguments']['name']['require_value'] = 0;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'portal' => 'portal',

/* Display: Portal List */
$handler = $view->new_display('block', 'Portal List', 'portal_list');
$handler->display->display_options['display_comment'] = 'Displays a list of pages for a given Taxonomy Term Context
$handler->display->display_options['block_description'] = 'Portal';
$translatables['content'] = array(
  t('Portal List'),
  t('Sort by'),

3 Answers 3


The fundamental "problem" is that block displays don't get the argument from the url, which is fine. So you need to provide a way to give the block display the argument from url. Wait there is just the nid in the url.

So there is the wonderful thing called "default argument", which you can configure in the argument which allows you to bring any kind of arguments into. What you need is "taxonomy: term from url" and that's it.

  • 1
    Okay... So maybe this is a different question, but how do you get arguments when your using an alias url? Say I had it setup for mysite/article/saftey/home. Content Type/Term/Title -> node/??. I know it's a "different question", but how would you pass the arguments to the block that way?
    – WernerCD
    Commented May 6, 2011 at 12:44
  • Actually... either way: node/# OR url-alias... the "Taxonomy: term from URL" doesn't work for me: The Taxonomy Term ID isn't in the URL. in the Above picture, there is no taxonomy in the URL. It's all "content" in the URL. if I do mysite/taxonomy/term/8... or mysite/sports/basketball (current setup for testing) it works perfectly. But for stuff on actual content pages, I'm getting zip zilch zero.
    – WernerCD
    Commented May 6, 2011 at 14:23
  • Views does not know anything!! about the path aliases. You should also not try to get informations out of the url, because the path aliases might change. The taxonomy: term from url works indepdent from your path aliases. Commented May 7, 2011 at 18:15
  • I got it working (and then broke it by doing something else). I need to rebuild it, but I do know it involed Relationships. You have to build a relationship between the URL and the taxonomy on the page.
    – WernerCD
    Commented May 8, 2011 at 16:18

I've actually moved on from this into a module "node hierarchy" which when paired with path-auto and menu-block does wonders.

But for the Views... the issue was solved with the right "relationships". Either a relationship on the Taxonomy ID, description or title... against the field on the node. I don't have it in front of me, but if requested I still have it in my notes somewhere.

  • I'd love to see what you did with this in views, I am wrestling with something like it right now. Commented Jul 13, 2011 at 1:10
  • Let me pull up my notes in a bit and I'll see if I can find the view I used (or I should be able to rebuild it and post it for you).
    – WernerCD
    Commented Jul 13, 2011 at 16:05

I had to do all of the above AND remove the third argument from my views_embed_view function call:

<?php print views_embed_view('recommended_documents', 'three', **$node->id**); ?>

I believe the arguments from the third onwards become the contextual filters values that are checked against, which we're looking to override with the URL.

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.