For my Drupal 8 website, I need to create a view page, where I would like to list only 4 specific nodes of "Basic page" content type. How could I handle it? Under filter menu there is no option to filter content based on nid. Did anyone have such an issue?

| improve this question | | | | |
  • Did you look for NID or ID? – Kevin Mar 14 '19 at 12:14

You can achieve this using Context filter

  2. Add Content: ID
  3. WHEN THE FILTER VALUE IS NOT IN THE URL > Provide default value
  4. Add your ids combined with '+'. for example, 1+2+3 for ids 1,2 and 3
  5. Go to MORE
  6. Check Allow multiple values

Refer the two images Add your ids

Allow multiple

Hope this helps you...

| improve this answer | | | | |

What was called NID in Drupal 7 is now simply ID under the Content Category in Drupal 8.

To filter out specific nodes you need to add as many ID Filters (each Filter for the specific node) and then use OR operator in between them.

Or you can use the Regular expression Operator in a single Filter that would "solve" for the exact node IDs you need.

Here's a similar question from the opposite direction: How to exclude multiple nodes based on their ID in taxonomy term view?

| improve this answer | | | | |

Your Answer

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