Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Route Condition

Security covered Under active development 3,028 sites

This module allows you to set conditions based on specific Drupal route names. This is useful for controlling where and when certain elements, like blocks, become visible, similar to how the "Pages" condition works but by matching route names instead of URL paths.

Route Condition provides a Condition plugin that matches on route names instead of URL paths. Use it anywhere Drupal accepts condition plugins, such as block visibility or the Context module.

It works like the core "Pages" (RequestPath) condition, but you enter route names such as entity.node.canonical instead of paths such as /node/*. Route names don't change when path aliases, URL prefixes or languages change, so the condition keeps working.

Features

  • Match one or more route names, one per line.
  • Use * as a wildcard: entity.*.canonical matches the canonical page of every entity type.
  • Use <front> to match the front page.
  • Put ~ before a route to exclude it.
  • Matching is case-insensitive.
  • The block visibility form shows a summary of the configured routes in its vertical tab.

Requirements

Drupal 10.2 or later, 11 or 12. No other modules are needed.

Installation

composer require drupal/route_condition
drush en route_condition

Edit a block. Under Visibility, open the Route tab and enter your routes.

Similar modules

  • Core's Pages condition matches on URL paths, not route names.

Support

Report bugs and feature requests in the issue queue. Merge requests are welcome.

Drupal 10–11

Ask your assistant about Route Condition

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
5
Tracked since
Jun 2024
Latest release
2 days ago
Releases (12 mo)
4 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
2.1.2 Stable 10–11 Oct 13, 2026
2.1.1 Stable 10–11 Feb 13, 2026
2.1.0 Stable 10–11 Feb 3, 2026
2.1.x-dev Dev 10–11 Feb 3, 2026
2.0.3 Stable 8–11 Jun 20, 2024