Rabbit Hole Module (Drupal 8 Tutorial) (Article + Video)

Submitted by TheMain on Tue, 10/11/2016 - 19:01

Control what should happen when an entity is being viewed at its own page.

Use Case

  • You have a view that lists articles but you want to disable access to single articles in node/[nid]


drush -y en rabbit_hole

Note: at the moment (2016.12.01) there isn't a stable release available.

How To Use It

  • Go to admin/modules and enable the entity types you want to restrict access to:

  • Go to admin/structure/types/manage/article and you can find the Rabbit Hole settings at the bottom.
  • Select Access denied as the behavior:

Now you can see the articles listed in the front page:

But if you click them, you get access denied:


  • Go to /admin/structure/types/manage/article

You can also choose Page not found behavior or make a Page redirect.

Install Token module to see the token widget in the image: https://www.drupal.org/project/token

In this case you would be redirected to the login page whenever you try to access an article in node/[nid].

Overrides And Permissions

You can allow these settings to be overridden for single entities in /admin/structure/types/manage/article:

  • Edit any article and you have the option to change the behavior for that single entity:

You can also allow certain roles to bypass Rabbit Hole in /admin/people/permissions:

Posted by Samuli Natri on 11 October 2016