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.
This module includes sub-modules responsible for adding this behavior to different entities. Currently supported entities are:
- Taxonomy terms
- Field collection
- Profile 2
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.
- In the admin toolbar, click People -> Roles -> Add Role
- Give role name as VIP
- Click Save
Here, let's create an authenticated user and a VIP user.
- Click People -> Add User
- Enter data and select role as VIP
- 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
- Click Structure -> Content Type -> Add Content Type
- Give an appropriate name and description for the content type
- Click Rabbit Hole Settings
- Keep the option "Allow these settings to be overridden for individual entities" checked. It will allow administering permissions on a node basis
- Choose the redirect option and enter the URL of the site you want to redirect to
- Click Save and Manage Fields.
Set access permissions
Users with a VIP role will need to be able to bypass Rabbit Hole control.
- Click People -> Roles
- Click the VIP role drop-down arrow and click Edit Permissions
- Find and check Bypass Rabbit Hole action for content permission. Save permissions.
Add new comment