Using Drupal 7 and Views 3 I am trying to setup a block to show related content based on taxonomy terms.I have read numerous articles and threads on how to do this but none seem to work, this might be due to using a view and custom path rather than displaying the node directly.I have done the following.

  1. Created nodes and added Taxonomy terms to each.
  2. Created a view for each node, the views have a custom path.
  3. Created a block view, added contextual filter on "Has Taxonomy Term ID". I have set default value "Taxonomy term ID from URL" and clicked the LOad Default from node page checkbox.
  4. Added the block to sidebar.

My URL are of the format www/example.com/name , there is only 1 argument, I am struggling to understand how the filter can pick up the term from that URL and would like to know if there is a simple way around this. The problem seems to either lie with my URL or that I'm displaying the node through a view, I would have thought these were both common scenarios that wouldnt require any coding, any help on how to workaround this would be much appreciated. I am leaning towards using mini panels but having spent some hours with them would rather just use views if possible. Thanks

EDIT I think this is very likely view/path related, going to the content page directly displays the block with the related content, its on the View pages with their own paths this is not working. My views are simply Page views with normal filters on the content type and on a taxonomy term (which is different to the term on the contextual filter).

3 Answers 3


Creating a related content view in Drupal 7:

Show related content based on shared Term-pages (from any given vocabularies).

Each term page will be recognized by the term ID (TID) hidden in the pages’ URL.

The process:

Basic stages:

  1. Create a “Content” view-block.
  2. Add a contextual filter: “Has taxonomy term ID”.
  3. Choose “provide a fixed value”.
  4. (From type): “Taxonomy term ID from URL“.


• Uncheck “Load default filter from the term page”. • Check “Load default filter from node page, that’s good for related taxonomy blocks”.

• Check “Limit terms by a vocabulary”. • Check your desired vocabulary.

  1. Select “Filter to items that share any term”.

  2. Go down and check “Reduce duplicates”: This will several terms that relate to the same page – To appear. Only one will of them will.



If you would like that the current node won’t appear in the list:

  1. Go to the view and add another, extra Contexutal filter.
  2. Give it content: NID.
  3. Select “Provide default value”.
  4. Set the “Type” to “Content ID from URL”.
  5. Go down in that window, click on “More”, and there check “Exclude”.

Note that this will exclude the current node in which the related is shown – From that very list.

It will do so by using the content ID which is a (hidden) part of the URL.

  • Benia, this is pretty much what I have been doing. In Step 2 you mean add the contextual filter to the Block display? In my case this is a separate view, or should this be a separate display that is part of the same view?
    – Chris M
    Commented Jul 2, 2016 at 20:50
  • Yes, it belongs to the view-block. I did all in one single view --- A view-block.
    – user16289
    Commented Jul 2, 2016 at 21:40

I guess the problem was using a view with a custom url with a contextual filter to display a block that gets its data from another view with a custom URL, this doesn't appear to be possible without custom code. In the end I used the panelizer module to display my node, added a sidebar in panelizer and added the content as block, on the block I was able to use the method described by Benia to add the contextual filter.


Why don't you try Views Related Content Module. Install this module and follow:

  • Create a View block with content type
  • Add "Related Content: Term" as Content Filter Criteria
  • Select the vocabulary you want to short by
  • Save the view and place the view block from drupal block administration page

That's it.

There's a step by step tutorial available on drupal forum.

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.