Output data of different content types in same page I have two content types :


Content type 1 named book with two fields author and language
Content type 2 named movie with two fields date and resolution


In my-theme/templates/page.html.twig I want to render a first section with all the books and a second section with all the movies :

&lt;div id="first-section"&gt;

&lt;h3&gt;Book Author 1&lt;/h3&gt;
&lt;p&gt;Book Language 1&lt;/p&gt;

&lt;h3&gt;Book Author 2&lt;/h3&gt;
&lt;p&gt;Book Language 2&lt;/p&gt;

&lt;h3&gt;Book Author 3&lt;/h3&gt;
&lt;p&gt;Book Language 3&lt;/p&gt;

&lt;/div&gt; 


&lt;div id="second-section"&gt;

&lt;h3&gt;Movie Date 1&lt;/h3&gt;
&lt;p&gt;Movie Resolution 1&lt;/p&gt;

&lt;h3&gt;Movie Date 2&lt;/h3&gt;
&lt;p&gt;Movie Resolution 2&lt;/p&gt;

&lt;h3&gt;Movie Date 3&lt;/h3&gt;
&lt;p&gt;Movie Resolution 3&lt;/p&gt;

&lt;/div&gt; 


How can I achieve that in Drupal 8 and Twig, is it mandatory to use pre-processing and provide the template with the variable, should I create views or blocks and render them in my page... What is the correct way to do that? 

A concrete example will be much appreciated !

&lt;div id="first-section"&gt;
    {% for book in books %}
            &lt;h3&gt;{{ [Book Author Here] }}&lt;/h3&gt;
            &lt;p&gt;{{ [Book Language Here] }}&lt;/p&gt;
    {% endfor %}
&lt;/div&gt;

&lt;div id="second-section"&gt;
    {% for movie in movies %}
            &lt;h3&gt;{{ [Movie Date Here] }}&lt;/h3&gt;
            &lt;p&gt;{{ [Movie Resolution Here] }}&lt;/p&gt;
    {% endfor %}
&lt;/div&gt;
These types of problems are usually solved using Views. 

You can create a single Page Display in Views listing the two Content Type nodes. Set the Page Path to what your link to that page to be. Add Sort Criteria by Content type so all the book nodes appear before the movie nodes (add more Sort criteria if necessary after that one). Make sure you set the Fields to be Hidden if Empty, since the two CTs you want to list don't share any Fields. Set that under each Field settings, and under Format settings.  

Another, probably more common way to build the lists is to create two different Views Displays, one for each Content Type. For example you can create a Page Display to list only the book nodes with the two related Fields, then add Attachment Display in the same View and override it to show only movie nodes. Also override the Fields to show the two Fields you have on movie CT, instead of the two Fields from the book CT. Set the Attachment to show on the Page Display.