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-&gt;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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach ($items as $item) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $build['list']['#items'][$item-&gt;id()] = [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#type' =&gt; 'link',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#url' =&gt; $item-&gt;toUrl(),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#title' =&gt; $item-&gt;label(),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</pre><p>to</p> <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach ($items as $item) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $build['list']['#items'][$item-&gt;id()] = [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#type' =&gt; 'link',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#url' =&gt; $item-&gt;toUrl('canonical'),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#title' =&gt; $item-&gt;label(),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</pre> > Related issue: [Issue #3415571](https://www.drupal.org/node/3415571)
issue