Quicktip: Hide unwanted pages with Rabbit Hole module

Published January 11, 2021

I like to think of this module as something you don't realize you need until you understand exactly what it does. With that in mind, let's start with an example…

Imagine you have a "Document" content type (or media entity) that you use to upload PDF files to your site. Document entities are then used as part of various other entities (often content types) on your site via reference fields. Now for the important bit: Document entities are not meant to be viewed on their own - they are only meant to be available as a part of another entity via a reference field.

When a site design calls for this type of situation, what happens to the "Full display" view (/node/[nid] or /media/[mid]) mode of the Document entity? Often it is ignored; not even styled for display. Under normal circumstances the full display view mode has no reason to ever be requested, but if developers never had to worry about edge cases, then our lives would be much easier.

This is where the Rabbit Hole module enters the picture - it allows us to specify (via the bundle's "Edit" page) that if someone tries to load the full display view mode, the Rabbit Hole module kicks in and directs the user to a specified path.

Rabbit Hold module screenshot

So, if you have entities on your site that aren't meant to be displayed on their own, it's best to use the Rabbit Hole module to ensure your site visitors don't end up on a page you're not expecting.

 

Sign up to receive email notifications of whenever we publish a new blog post or quicktip!

Name
CAPTCHA