Drupal 8 related taxonomy contextual filter on nodes for a views block
For 2 nodes labeled with the same taxonomy, configure a block to show content tagged with that taxonomy.
Example: If you have a node tagged with the taxonomy shirts and you want to show a block that would display a related shirt.
Create a block to display related content tagged by taxonomy using views.
Create a block view with the appropriate Filter Criteria: Content Type etc...
Under the Advanced menu add two contextual filters.
- Contextual Filters - Content: ID</lh>
- Select provide a default value and choose Content ID from URL.<p class="gray">this does what it does</p></li>
- Under More tab - Check next to Exclude<p class="gray">this does what it does</p></li>
- Contextual Filter - Content: Has taxonomy term ID
- When filter is not available - Provide a default value - Taxonomy term ID from url
- Uncheck, load default filter from term page
- Check, Load default filter from node page, that’s good for related taxonomy block
- Multiple value handling: Filter to items that share any value
- Check, Reduce Duplicates
- Under more tab check: Allow multiple values and Allow multiple values to work together.
Now I have 2 nodes that are labeled with the same taxonomy as the node being viewed as a footer.