This module enhances Drupal's content visibility controls by allowing you to specify both included and excluded paths, including subpaths. It provides granular control over where blocks and other content appear on your site by defining specific pages and exceptions.
Extends the condition plugin API to add included and excluded paths to control
content visibility.
Show and hide content such as blocks on specific paths
The condition plugin builds on top of the Drupal Core Request Path plugin, also known as 'Pages' visibility of Blocks. The latter allows only whitelisted paths OR blacklisted paths to control content visibility while this plugin allows both whitelisted AND blacklisted paths and subpaths.
The module works the same as the Core 'Request Path' (Pages) plugin but allows using "!" as a path prefix to exclude a path. Wildcards can be used in the middle or end of a path.
Example 1:
Make a block visible on the /user page and all its subpages, except for the 'messages' subpage. The block will be visible on subpages of 'messages' (e.g. /user/*/messages/578):
- /user
- /user/*
- !/user/*/messages
Example 2:
Display a block on all pages of the website, except on product (sub)pages but allow the block on product review pages:
- *
- !/products/*
- /products/*/reviews
More examples can be found in the readme of the project.
This condition plugin gives you full control on which paths content should and should not be displayed.
Similar modules:
- Block Exclude Pages: Does the same thing but without using Drupal's condition plugins and is limited to Block visibility only.
Ask your assistant about Condition Path
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
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 3.0.1 | Stable | 10–11 | Oct 21, 2024 | ||
| 3.0.0 | Stable | 10–11 | PHP ^8.1 | Aug 27, 2024 | |
| 2.0.4 | Stable | 9–10 | PHP ^7.1 || ^8.0 | Jan 30, 2024 | |
| 2.0.3 | Stable | 9–10 | PHP ^7.1 || ^8.0 | Jan 29, 2024 | |
| 2.0.2 | Stable | 9–10 | PHP ^7.1 || ^8.0 | Nov 14, 2023 | |
| 2.0.1 | Stable | 9–10 | PHP ^7.1 || ^8.0 | Nov 8, 2023 |