Skip to main content

How not to display content on its own page (full view mode)?

You may have a content type that should never be displayed on its own page, such as an image content type displayed in a carousel. Rabbit Hole can prevent this node from being accessible on its own page, via node/xxx.

What does the Rabbit Hole module do?

Maybe you have a type of content that should never be displayed on its own page, like:

  • An "image" content type displayed in a carousel.
  • A “news” type of content that is only displayed in a list page or in a block type view on the home page for example. In this case, search engines will index your content and users will be able to access it. As this type of content is not intended to be accessible, you do not have a template and the rendering is not correct
  • A taxonomy term that has its own page when it is not necessary or expected to display a page for each term.

Rabbit Hole can prevent this node from being accessible on its own page, via node/xxx.

The module works by providing several options to control what should happen when the entity is displayed on its own page.
You have the possibility to:

  • Display an "access denied" page.
  • Display a "not found" page.
  • Make a page redirect to any path or external URL (eg list page).
  • Or just display the entity (normal behavior).

The module is configurable by bundle and by entity. There is also a permission that allows certain roles to completely override Rabbit Hole and not be redirected for example.

Supported entities

This module includes sub-modules responsible for adding this behavior to different entities. Currently supported entities are:

  • nodes
  • Taxonomy terms
  • Users
  • Files
  • Field collection
  • Profile 2
  • bean

Other possibilities with page display control

You want to grant or deny user access to specific entity types or Drupal entities based on user roles, for example, to display paid content to users with a subscription. Special user roles can be authorized to bypass the Rabbit Hole action.

Create a VIP role

When you create a VIP role, only paying users will be allowed to view content. Without a paid subscription, the user will be an authenticated user.

  1. In the admin toolbar, click People -> Roles -> Add Role
  2. Give role name as VIP
  3. Click Save

Create users

Here, let's create an authenticated user and a VIP user.

  1. Click People -> Add User
  2. Enter data and select role as VIP
  3. Click on Create a new account

Similarly, create another user with the Authenticated role. After that, the People page will look like this.

Create a VIP content type

  1. Click Structure -> Content Type -> Add Content Type
  2. Give an appropriate name and description for the content type
  3. Click Rabbit Hole Settings
  4. Keep the option "Allow these settings to be overridden for individual entities" checked. It will allow administering permissions on a node basis
  5. Choose the redirect option and enter the URL of the site you want to redirect to
  6. Click Save and Manage Fields.

Set access permissions

Users with a VIP role will need to be able to bypass Rabbit Hole control.

  1. Click People -> Roles
  2. Click the VIP role drop-down arrow and click Edit Permissions
  3. Find and check Bypass Rabbit Hole action for content permission. Save permissions.

Other useful resources

Add new comment

Similar blog posts

How to delete local changes with git that you haven't committed ?