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.*.canonicalmatches 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.
Supporting organizations:
Maintenance
Maintenance
Sponsored initial development
Sponsored initial development
Project information
- Project categories: Content display
3,569 sites report using this module
- Created by svendecabooter on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
