Is there a way in views to return 1 node that was published before the current node being viewed and the 1 node after?

Currently I have a view using a contextual filter which is the current NID from URL but I can't find a way to pass that to the filter criteria.

Is it possible? It can be split in to 2 views if needed so in 1 I get the previous node and the other I get the next one.


current nid = 2

View returns 1, 3

  • Do you want to get links for the nodes or entire nodes ? Commented Sep 17, 2012 at 10:54
  • In the view it'll be pulling out fields.
    – Alex Older
    Commented Sep 17, 2012 at 11:56
  • fields of nodes ? If you want fields of nodes then my answer below will provide function to fetch previous and next nid also. Use nid and you can fetch desired fields. Commented Sep 17, 2012 at 12:22

1 Answer 1


You can use Previous/Next API to get the previous and next nodes of particular nodes. It also provides Views plugin to display Previous/Next links in View.

  • did what I needed it to do. Documentation is a little thin on the ground
    – Alex Older
    Commented Sep 17, 2012 at 15:16
  • Can you explain how to get this option in views.there is no extra options in views related to the prev/next api.
    – Aparna pc
    Commented Oct 31, 2013 at 12:05

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.