- 404 node is set in admin/config/system/site-information
-
in Drupal 8
\Drupal::service('current_route_match')->getRouteName() returns the routepath 'system.404'

this doesnt work in drupal 9
it returns only entity.node.canonical

so its not possible the theme the 404 page

Comments

t.seifert created an issue. See original summary.

Version: 9.1.x-dev » 9.3.x-dev

Drupal 9.1.10 (June 4, 2021) and Drupal 9.2.10 (November 24, 2021) were the last bugfix releases of those minor version series. Drupal 9 bug reports should be targeted for the 9.3.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

tinarey’s picture

Status: Active » Closed (works as designed)

If you've set an error node on admin/config/system/site-information, you can use `hook_preprocess_page` to add your own templates. Eg see this patch in Olivero as example https://www.drupal.org/files/issues/2021-05-14/3182242-39.patch

tinarey’s picture