Related post by using Term with Views in Drupal

author details
AdiPie
12th Aug 2020
2 mins read
Image
related-post-using-terms

It is safe to say that you are attempting to add a blog of related content  to a node  page in Drupal. Would you like to show different node which shares terms with the at present displayed node? 

we should consider our content. Suppose we have four node of a specific content type, named: 

  • Book A
  • Book B
  • Book C
  • Book D

With this information, we need to show related content dependent on the terms that are applied to every node. 

For Book A

Our prerequisites for our related content by term in Drupal usefulness are that the related content should: 

  • Not show the current node
  • Show node matching any term 
  • Not contain any duplicate nodes

Creating a Drupal related content Block with Views 

Ensure you've made your nodes. At that point, add taxonomy and terms. At that point, create a View->Block. We should walk through the other significant focuses in screen captures: 

Add a Contextual Filter->Has Taxonomy Term ID 

Image
drupal-related-content-1

Evacuate Duplicates with the Contextual Filter 

Image
drupal-related-content-2

Include another Contextual Filter however with Content: NID 

Image
drupal-related-content-3

Evacuate the Current Node with the Contextual Filter

Image
drupal-related-content-4