Blocks cause WSOD; Cannot generate default URL
Problem/Motivation
Placing a block containing a feed causes the page where the block is placed to error.
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).
The problem call to toURL() is in src/Plugin/Block/AggregatorFeedBlock.php
To fix, change
foreach ($items as $item) {
try {
$build['list']['#items'][$item->id()] = [
'#type' => 'link',
'#url' => $item->toUrl(),
'#title' => $item->label(),
];
}to
foreach ($items as $item) {
try {
$build['list']['#items'][$item->id()] = [
'#type' => 'link',
'#url' => $item->toUrl('canonical'),
'#title' => $item->label(),
];
}Edited by drupalbot