Related content

Relate content based on common tags.

Show 5 items from each related taxonomy term.

  1. Create a view listing content.
  2. Create a block display.
  3. Add contextual filter for content ID from URL.
  4. Relate terms in field_tags.
  5. Relate content referencing terms in field_tags.
  6. Add fields for tag name (excluded), related content title.
  7. Group items by tag name.
  8. Filter block for field_tags delta 0.
  9. Limit results to 5 items.
  10. Set block to hide if empty.

Now you have a block that  shows 5 items wit the first related tag.

Clone this to create blocks with filters for delta 1 and 2.

Bonus: Reusable layout block

Wrap the blocks in a 3 column grid.

  1. Enable layout builder per item for custom blocks.
  2. Create a reusable block in the block library.
  3. In the block's layout, add the related tag delta blocks.

Bonus: Prefix tags with #

You can prefix the tag in the group header with #.

Rewrite results of the field with #{{ field_tags }}

Tags