Condition Path
Condition Path settings

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.
Supporting organizations: 

Project information

Releases