How can I loop through all article content types and get the content of each I created a new article content and am overriding that by creating a template for it (ie: node--4.html.twig).

Then inside this template, I want to loop through all nodes that belong to article content type; and to achieve that, I created my .theme file and added the following code based on the answer for this question here:

&lt;?php
  function capoeira_preprocess_page(&amp;$variables) {
  $articles = \Drupal::entityQuery('node')-&gt;condition('type', 'article')-&gt;execute();
  $nodes = \Drupal\node\Entity\Node::loadMultiple($articles);  
  $variables['articles'] = $nodes;
}


Inside the template I do have:

{{ kint(articles) }}


inside my template and I go refresh the page I show article as NULL.

How do I loop through the articles?

EDITED:

None of the below work:

function capoeira_preprocess_page(&amp;$variables) {
  $articles = \Drupal::entityQuery('node')-&gt;condition('type', 'article')-&gt;execute();
  $nodes = \Drupal\node\Entity\Node::loadMultiple($articles);
  $variables['name'] = $nodes;
}

function capoeira_preprocess_node(&amp;$variables){
  $variables['name'] = 'My name comes here';
}

function capoeira_preprocess_node_article(&amp;$variables){
  $variables['name'] = 'My name comes here';
}
you can use 

function YOURTHEME_preprocess_node_article(&amp;$variables){
  $node = $variables['node'];
   $nid = $node-&gt;id();
   // similarly you can fetch other fields
}


then override article content type as node--article.html.twig
and pass data to twig file