Related Nodes Block - View Mode Output
Related Nodes Block - Text Output
Related Nodes Block - Block Settings
Related Nodes Block - Row Filter
Related Nodes Block - Row Display

This project is not covered by Drupal’s security advisory policy.

Provides nodes blocks that are related to the node that they are displayed with, related by Content Type. Works with D8.8+ and D9.


Introduction:

To display a list of related nodes on current node page, the Views block requires contextual filters with taxonomy terms. It is not ideal in many cases to add taxonomy terms just for this purpose, when the content type itself can be useful for grouping. RNB is a highly customizable module that provides a way to create lists of related (or even unrelated) nodes based on Content Type alone, without requiring special taxonomy terms.


Features:

  1. Previous, Next, Most Viewed Today, Least Viewed Today, Most Viewed, Least Viewed, First, Last and Random list of related nodes.
  2. Selectable content type of related nodes, including content type (or excluding if you like) of current node page itself, or a specific node even.
  3. List rendered as linked text or view (display) mode (as set in Content Type > Manage Display).
  4. Text customizable with tokens.
  5. Block and row-level prefixes and suffixes.

Example:

Lets say our Drupal site has structurally very distinct content types: Blog and DIY. We now want navigation on each page of Blog and DIY, that takes the visitor to the previous/next item of the same content type as the current node page.

Steps:

  1. Create 2 separate RNB blocks: one for "Previous" and one for "Next" (place and style them in appropriate regions as desired).
  2. For the "Previous" block, in the block configuration:
    • Select Previous for the Display Type.
    • Disqualify all content types by selecting all content type in the list (no selection means all selected), and negate it.
    • Now Include current content type of the node this block is on.
    • Limit the number of qualifying rows to 1 (maybe we just want to render it as a button instead of a list).
    • Choose your display mode: maybe a "Teaser" view mode. Please keep in mind that since this block will render for both Blog and DIY, this view mode must exist for both. If for a particular content type the selected view mode is not defined, then as a fallback, linked text will be displayed instead.
  3. Repeat the same procedure for "Next" block.
  4. Style the output, there are plenty of default classes added to the output markup, with facility to add custom markup too in the block configuration.
  5. Visit the Blog and DIY pages to see the magic!

Remember:

This is a very simple example just to get you started. You can play and experiment with loads of other options to get what you like!


Similar Projects:


Endnote:

README.txt in the module root directory has further detailed information.


Project information

Releases