How to Display children on the Taxonomy term page? I think my problem is quite simple but I don't manage to find the solution on the internet (I found solution for Drupal 7, but they don’t apply to Drupal 8).

I have a taxonomy like :


  Fruits
     
       Red fruits
          
             Strawberry
             Raspberry
          
       Black fruits
     
  Vegetables


Using Views in Drupal 8, with the preconfigured Taxonomy term, I'd like that when I click on a parent, it displays all the children terms and the nodes within these children terms. (eg. when I click on Fruits, it display all nodes in Fruits, Red Fruits, Strawberry, Raspberry and Black fruits ; and when I click on Red fruits, it displays all nodes within Redfruits, Strawberry and Raspberry).

Indeed, by default, when you click on a parent term, it only shows nodes within this parent term, but not those who belong to children. (eg. when I click on Red fruits, it only display nodes within Red fruits, but not those in Strawberry or Raspberry)
I finally found the solution. My Drupal is in french, I tried to translate, but my translation may not match the exact words :)

Go to View and edit the default Taxonomy term (content) page.
In Contextual filters :


select "possède l’identifiant de terme de taxonomie (avec profondeur)" and configure like this :


depth : choose the depth you want
check Allow multiples values
check Provide a default value and choose Taxonomy term (ID) from URL
select Filter by elements that share all terms
check Override title and write {{arguments.tid}} in the field
check Specify selection criterion and choose Taxonomy term (ID)

select "possède l’identifiant de terme de taxonomie avec modification de profondeur"


Now, if you have a complex taxonomies, go on a taxonomy term page may display the same result several times. To prevent this, in your View, go to Other section (under Contextual filters) and click on Query parameters. Then check Distinct.

Enjoy !