Blocks cause WSOD; Cannot generate default URL
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3414579. -->
Reported by: [john_b](https://www.drupal.org/user/710760)
Related to !13
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Placing a block containing a feed causes the page where the block is placed to error.</p>
<blockquote><p>Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: Cannot generate default URL because no link template 'canonical' or 'edit-form' was found for the 'aggregator_item' entity type in Drupal\Core\Entity\EntityBase->toUrl() (line 176 of /home/website/test_html/web/core/lib/Drupal/Core/Entity/EntityBase.php).</p></blockquote>
<p>The problem call to toURL() is in src/Plugin/Block/AggregatorFeedBlock.php </p>
<p>To fix, change</p>
<pre> foreach ($items as $item) {<br> try {<br> $build['list']['#items'][$item->id()] = [<br> '#type' => 'link',<br> '#url' => $item->toUrl(),<br> '#title' => $item->label(),<br> ];<br> }</pre><p>to</p>
<pre> foreach ($items as $item) {<br> try {<br> $build['list']['#items'][$item->id()] = [<br> '#type' => 'link',<br> '#url' => $item->toUrl('canonical'),<br> '#title' => $item->label(),<br> ];<br> }</pre>
> Related issue: [Issue #3415571](https://www.drupal.org/node/3415571)
issue