I created a content type x.

I added 4 contents.

My contents look like this.

enter image description here

I created a views page. (xxx.com/mypage),

enter image description here

I created a views block placed in sidebar. (displayed sidebar of xxx.com/mypage),

enter image description here

This is how the page looks like,

enter image description here

Each time I click a title in sidebar, I like the corresponding views page to be displayed. Currently, title takes me to orginal content. Thats not what I want.

Example: If I click Chapter1 Title1, I like to see chapter1 title1 body page, If I click Chapter2 Title1, I like to see chapter2 title1 body page.

I think I need to use contextual filter and I am not sure how I can do that to make it happen.

Please advise.

enter image description here

1 Answer 1


You are correct. You can use contextual filters to achieve this. There are two parts to the solution.

The first is the views page, which you labeled xxx.com/mypage. You will need to add a contextual filter using Content:NID. You would then change your views page's path to uft/%. Then, for instance, navigating to xxx.com/uft/2 in your browser would result in accessing your views page with only the information for node 2 shown.

The other half of the solution is in the block. You will first need to add one more field to your block's fields, NID. Make sure to check the 'Exclude from display' checkbox while adding it. Once you've added NID, you'll need to rearrange the fields so NID is above title. Now you are ready to change what the Titles in your block link to. When you click Content:Title under the Fields section you will first want to uncheck 'Link this field to the original piece of content'. Next, you should see a collapsed fieldset titled 'Rewrite Results'. Click that to expand it. In the text box, entering uft/[nid] should complete the process.

At this point, your views block should be generating xxx.com/uft/target_nid as the link targets for the titles in the block and when you click them you should arrive at your views page with the selected nid passed as a contextual filter argument.

  • I was able to follow step by step. It worked. Many thanks. When I clicked title link in views block, I expanded 'Rewrite Results'. I entered uft/[nid] in the text field did not work. I checked 'output this field as a link' and then entered uft/[nid] in the link path. It worked. One final question, when each link I click, I get the views page(i.e. uft/2 or uft/3). How can I see the next and previous link so i can navigate to other pages depending on what page I am on. It means if I am on uft/2, I should see next (takes me to uft/3) and previous links (takes me to uft/1).
    – autop
    Oct 21, 2016 at 23:08
  • I added one more image to the original post. I can see Next and Previous views edit page but I dont see it in actual views page (i.e. xxx.com/uft/1)
    – autop
    Oct 21, 2016 at 23:19
  • Again, I did see pager of the view on views page before I solve the issue. After I solve the issue, I do not see the pager on my views pages. I still see the pager in admin side. Any help please?
    – autop
    Oct 22, 2016 at 20:13
  • When you use a contextual filter like this, you are limiting your result set to 1 item. The pager will not show for a result set of 1 item because there is no next or previous item to link to within that set.
    – J.P.
    Oct 24, 2016 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.