How To Add A Related Content Block In Drupal

Do you want to add a related content block in Drupal? Here is the instructions of how you can add a related content block in drupal 7 & 8 using views or views extension with steps and images.

There’s a lot of discussion about Related Content block in Drupal on the web and Here’s another one that aim to help drupal users find the best solution to add a related content block in drupal.

Drupal is a one of the popular content management system and it comes with a lot of advantages and features that makes it 2nd most popular CMS on the web. Drupal is a pure CMS that can be used to create a simple blog or even a large website with many content type and functionality. However, If you are a beginner in drupal, It may be a little difficult to add some element like related content block in your web page.

I’ve seen a lot of discussion where users want to know how they can add a related content block in drupal. That’s why I’m writing this, So you can follow this guide to find the best solution for adding related content block in your drupal.

Adding Related Content Block In Drupal 7

There are a couple of ways you can do this, But in this tutorial, I will show you the most easiest method that you can follow to create a functioning related content block in drupal.

I’am gonna use a views extension and I assume you have Views module installed in your Drupal. The very first step is installing Views Related Content module that is a extension to the views module. It helps you in displaying related node or content in the content display page based on content type, taxonomy and node author. You can also filter the content using views default filter rule.

One of the biggest drawback of this module is, It only support drupal 7. If you are using drupal 8, please follow the next method that works on both drupal 7 & 8.

Step 1: Download and install Views Related Content module, As I wrote earlier, Views Related Content module is an extension of Views module, So make sure you have Views installed. If you need help in installing module in drupal, Here is a great video tutorial.

Step 2: Once the module is installed, Now create a new block view of content type and choose the display format and the number of items you want to be displayed. In my case, I’ve used the default 5 items without pager and HTML list as display format.

After that hit Continue & edit button to proceed next.

Step 3: In this step you will have to filter the content in FILTER CRITERIA section to display the related content in content display page. To do that, all you have to do is, add a filter by clicking add button in FILTER CRITERIA section.

After that, Views will display a set of filter that you can apply. From the list of filter, you will have to select “Related Content” filter that comes with 4 different type of criteria. These are:

  • Related Content: Author“: Short content by the author of node.
  • Related Content: Content Type“: Display content from the same content type in node display page.
  • Related Content: Field Reference“: This will short content by the Entity (field reference).
  • Related Content: Term“: Filter content to display based on the vocabulary/taxonomy and we are going to use this.

Views Related Content Filter

Of-course, You can chose any one or multiple from these four type of related content filter.

Select the related content filter type that you want to apply and hit Apply button.

Step 4: In this step you will have to configure the related content filter. For an example, Which taxonomy term you want to short by (If you have multiple vocabulary & Chosen to short content by term). In my case my settings are similar to this one below:

Related Content By Term

Don’t forget to add additional filter like content type, So the only selected content type will roll up. In my case, I don’t want any basic page and webform to be displayed, That’s why I’ve added additional content filter that hide webforms and basic page type of content.

That’s it, Now add additional field like Image or anything else you want to be displayed and save the settings.

Related content view block has been created successfully, Now place the related content block where you want it to be show up from Drupal Block administration page.

How To Add A Related Content Block In Drupal 8

As you guys know, Drupal 8 has built in Views integration but Views related Content module not yet developed for Drupal 8. Don’t feel so bad for this, Because we can do it manually that works both in drupal 7 & 8.

We will be show you how to add related content block based on taxonomy term in drupal 8. To do that, We need taxonomy term enabled for the content type you want to be shorted in related content display.

Step 1: Create a view block of content as you did in previous method in step 2 and don’t forget to give it a nice name.

Step 2: Add fields that you want to be show up along with related content in related content block.

Step 3: In this step we will be going to add contextual filters that short content based on the taxonomy terms. Here is How you can do this:

The contextual filters is hidden under advanced dropdown section by default, Just click on Advanced to expand options.

Views contextual filters

  • Add a contextual filter “Has taxonomy term ID
  • Select “Provide default value” radio button
  • Select “Taxonomy term ID from URL” as type
  • Uncheck “Load default filter from term page
  • Check “Load default filter from node page, that’s good for related taxonomy blocks” checkbox, Expand new option
  • Check “Limit terms by vocabulary“, Expand new option
  • Select the vocabularies that you want to short by
  • Select “Filter to items that share any term
  • Scroll down and check “Reduce duplicates“, It will prevent the same content from being displayed multiple times
  • Click on the Apply button to save the contextual filter and save the view block.

Has taxonomy term ID contextual filter

That’s it, Your related content block has been created.

Step 4: Here is an optional steps that help you in removing the current content/node from related content block

  • Add another contextual filter “Content: ID” for drupal 8 while “Content: NID” for drupal 7.
  • Select “Provide default value“, Expand new option
  • Select “Content ID from URL” as type
  • Scroll down the page and find “”More” dropdown
  • Check “Exclude” and click apply button to apply settings

Content ID Contextual Filter

Now you can place the block in your webpage from drupal block administration page.

Hope this tutorial help you in adding a related content block in your drupal installation. Have you encountered an error while following our guide? Have you know any other method that can do the same? Let us know using the comments below.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive website improvement tips and tutorials.


We'll periodically send useful information, tips & tutorials to improve your website performance, conversion optimization, SEO and design tweaks to make your website better.

Thank you for signing up!

Please check your email and click the link provided to confirm your subscription.

Powered by Rapidology
No Comments

Post a Comment