0

I am following How to create a nearest node view / Sorting by proximity, which at the fist point says:

Under Advanced, add a contextual filter returning the center entity's ID. For example, if you want to show the view on a node, as a block, select the "Provide default value" radio button and underneath for Type, select "Content ID from URL".

Which contextual filter should I use? I tried Global: Null, but it doesn't seem to be the right one.

1 Answer 1

2

The idea here is that you are creating a block to display on the node and need to add a contextual filter to return the nid to filter the results. You need to add the "Content: Nid" contextual filter.

You can do this by:

  1. Add contextual filter
  2. Select "Content: Nid"
  3. Under "When the filter value is NOT in the URL" select "Provide default value"
  4. Then under "Type" select "Content ID from URL"

This will automatically get the nid from the URL (node/nid) and apply the filter to the results.

2
  • man, you're right, and I think I am using the guide wrong. I am actually trying to implement the view as a block view. is this still possible?
    – arvil
    Jul 4, 2018 at 3:59
  • Yep you can definitely implement as a block view Jul 4, 2018 at 4:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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