Get top 5 recent post by taxonomy term I am new to Drupal and I have started overriding Twig files in Drupal 8. I have a requirement where I want other top 5 posts by taxonomy term.

Suppose I have a category as JavaScript. And I am on the node where I am displaying a post on JavaScript. On the same page I need other posts on JavaScript.

I have looked for twig file theme/templates/content/node--article.html.twig and tried to override it.

I have even tried to debug the node using kint tool. I have looked for my requirements in node and content variable.

{{ kint(node) }}
{{ kint(content) }}


But no success. I need suggestion where can I can other posts of same category in twig file. Any suggestion is appreciated.
First of all, you say:


  I have started overwriting Twig files in Drupal 8.


I hope you mean "overriding" Twig files.

Rule #1: Don't hack core.

Secondly, as leymannx suggests in the comment above, this is better accomplished using Views rather than in a Twig template.