Howto theme list of nodes as item-list? I want to show a block with related nodes. The function getRelatedArticles() is a complex one and I can't build it with views. Is it possible to use the method viewMultiple() and output the list as item-list? If not, what would be the best practisce becide looping over the array and build the render array for each node? Something similar to the following code (which obviously does not work):

class RelatedArticleBlock  extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {

    $related_nids = $this-&gt;getRelatedArticles();

    $nodes = Node::loadMultiple($related_nids);
    $block['content'] = [
      '#theme' =&gt; 'item_list',
      '#list_type' =&gt; 'ul',
      '#wrapper_attributes' =&gt; [
        'class' =&gt; [
          'row',
        ],
      ],
      // I want to do something like:
      // '#items' =&gt; \Drupal::entityTypeManager()-&gt;getViewBuilder('node')-&gt;viewMultiple($nodes, 'teaser'),
    ];

    // I would like to avoid the following, build each node on it's own.  
    foreach ($nodes as $node) {
      $block['content']['#items'][] = \Drupal::entityTypeManager()-&gt;getViewBuilder('node')-&gt;view($node, 'teaser');
    }

    return $block;
  }
}
viewMultiple() also optimizes the rendering process by returning a common #pre_render callback in the build array, see the discussions and linked topics here Twig: &quot;for&quot; does not display variable content without first displaying all variable content, so you can't put the output directly in #items.

So building each node on its own is the way to go and you probably won't find any differences in performance, because both methods result in the same caching mechanism.