Very often, we need to display a block related to a specific user (for example, his article or announcement), display the author of the node in the block, on the page of that node.
But at the same time, each user has his own list of announcements, each node has its own author and these blocks will be correspondingly different for each node and user. For such blocks, we have contextual filters in the view.
Now let's add a filter for the announcements so that only the data for our announcements is filtered on the ad page. Filter by nid field. Let's look at how this filter works. We have url nodes
Where 7 is the nid of our node. We tell Views through a contextual filter, filter us nodes by nid and for each node on different pages of nodes, we will display the corresponding node data. Add a nid filter:
Now we need to select Default actions for contextual filter, in this case to select Provide default value > Content ID from URL:
Now you can check the operation of our filter through the preview form. I have an announcements with nid 7, so I enter 7 and click on the preview button: