How DO I store/retrieve data and display them in templates? Coming from THE MVC pattern of Django, I am unable to grasp the concept in Drupal 8. I know Twig is used for templating, but what about storing/retrieving data in Drupal 8 and displaying them in templates? Suppose I have a content type (Activity) with fields like Image, Body, Files, etc. Someone can create multiple activities with a WYSIWYG editor. How do I retrieve all these nodes and display them in a page applying my own styles (not using views). Django Views are suitable for this. Can I do this without developing a module?
One way to achieve this is using preprocess function. In your theme's '.theme' file, write a preprocess function. Example:
In bartik.theme

function bartik_preprocess_html__node__28(&amp;$vars) {

$nids = \Drupal::entityQuery('node')
        -&gt;condition('type','article','=')
        -&gt;condition('status',1,'=')
        -&gt; execute();
$nodes = \Drupal::entityTypeManager()-&gt;getStorage('node')-&gt;loadMultiple($nids);
foreach ($nodes as $key =&gt; $value) {
$title = $value-&gt;title-&gt;value;

}
$vars['title'] = $title;

}


(node__28 is any node page where you want to see all results, I made this basic page)

Now in html--node--28.html.twig template, retrieve title of content type = article

{{ title }}