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?
You can achieve this using Context filter
- Go to ADVANCED > CONTEXTUAL FILTERS
- Add Content: ID
- WHEN THE FILTER VALUE IS NOT IN THE URL > Provide default value
- Add your ids combined with '+'. for example, 1+2+3 for ids 1,2 and 3
- Go to MORE
- Check Allow multiple values
Hope this helps you...
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?