Make a Drupal Menu Appear Only a Single Node

Make a Drupal Menu Appear Only a Single Node

An OSTraining member asked how us how they could display a menu block on one single page. They wanted to have relevant links appear only next to a single node.

For this tutorial, we will be using Views and menu block to provide a custom link block that will only display on a specific page to link to relevant information.

Step #1. Install the modules

We’re going to use three modules for this tutorial. So go head and download, install and enable these three modules:

Step #2. Create the node

  • Create the node that you will use for this tutorial. In this example, the node is called “Contract” and the content type is “Basic page”.
  • Add the page to the menu by clicking “Provide a menu link”.
  • Under URL path settings give the page a path.

Step #3. Turn the node into a View

  • Go to Structure > Views > Add new view.
  • Give the view a name.
  • Change “Show content of type” to the content type you used in Step 2. In this example, I choose “Basic page”.
  • Choose to create a Page and not a block.
  • Change “Number of items to display” to 1.
  • Remove the pager option.
  • Click “Continue and edit”.
  • Make a note of the “Path value” as we are going to use this link to add the page to the menu, save the view.

Step #4. Add the link to the menu

  • Go to Structure > Menu > Main menu > Add link
  • Add the name you want to appear in the menu and the path to the menu and save.

Now that we have a menu with a view I’m going to assume you already have your other pages configured and we will now add a link block and restrict it the contract page.

  • Go to Structure > Menu > Add menu
  • Give the menu a title and save.
  • Click “Add links”.
  • Give the links names and add the path for each link

Step #5. Place the menu

Now we need to place the menu on the site and restrict its view.

  • Go to Structure > Blocks.
  • At the bottom, you will see all the disabled blocks we are now going to add “side menu” to the region “side bar second”. This will make the block appear on the right of the content.
  • Save the block order change and then go into the configuration option for the block.
  • Under visibility, we are going to restrict what page this is displayed on by adding /contract as the only page that it displays the block on.
  • Save the block.
  • Now if we go to our contract page you will see that the side menu only appears on this page.


0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x