How to display the nodes belonging to the parent terms and to the child terms, of the term of the current page ?

Created on 23 June 2022, over 2 years ago
Updated 20 November 2023, about 1 year ago

On the default Drupal 9 installation, there is a tags field in the article content type. I allowed only one value for this field.

I have created terms and child terms for the tags taxonomy vocabulary.

In manage the form display of the article content type, I chose the "Selection list" widget for the tags field.

I created a view block to display all the nodes and placed it on each node's page.

I excluded the current page ID, with a contextual filter.

I want this block to show nodes sharing the same taxonomy term as well as its parent terms.

**Here is an example**

If I have the following taxonomy :

TAGS
- term 1
- term 2
- - term 3
- - term 4
- - - term 5
- - term 6
- term 7
- - term 8
- term 9

If the page of the current nodes reference term 5, then I want to display from the block all the nodes with the following terms.

- term 2
- - term 3
- - term 4
- - - term 5
- - term 6

If the page of the current nodes reference term 7, then I want to display from the block all the nodes with the following terms.

- term 7
- - term 8

If the page of the current nodes reference term 1, then I want to display from the block all the nodes with the following terms.

- term 1

So I want to have a block that displays all the nodes belonging to the parent terms and to the child terms, of the term of the current page. How can I achieve this?

I couldn't find anything in context filters to do this and I couldn't find any contributed module to help me.

πŸ’¬ Support request
Status

Closed: outdated

Version

9.5

Component
TaxonomyΒ  β†’

Last updated 8 minutes ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @xjm
  • πŸ‡¬πŸ‡§United Kingdom @catch
Created by

πŸ‡«πŸ‡·France zenimagine

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024