I just got the Drupal Similar By Terms module working with Drupal 8, and I want to share my notes here so (a) I can remember how this works, and (b) in case it helps anyone else.
Configuring a View for the “Similar By Terms” module
My configuration Cliffnotes are:
- Install the Similar By Terms module and enable it
- Create a new Block View (via admin/structure/views on Drupal 8)
- Create a Contextual Filter
- Select the "Similar By Terms" NID
- It’s very important to use this value
- This is shown as “Nid, Similar by terms” at the bottom of the “Add contextual filters” list when you click “Add contextual filter”
- On the “Configure contextual filter: Similar by terms: Nid” config screen:
- When the filter is not available -> Provide Default Value -> Content ID from URL
- Limit similarity to terms within these vocabularies to Tags. (Optionally use Category.)
- Save this Contextual Filter
- Under “OTHER”
- Use aggregation: Yes
- Sort Criteria (left side of View UI)
- COUNT(Content: ID), descending
- Filter Criteria (left side of View UI)
- Aggregation type: Group results together (important)
- Content: Publishing status = Yes
- Save the View
Testing the view with Preview
You can test the view by putting a Node ID in the “Preview with contextual filters” textfield. All of this is shown in the following image:
As you can see at the bottom of that image, similar nodes are shown for me in the preview area.
Last step: Create and place a block
The last step in this process is to create a block, and place it on the pages you want it on, in the theme region you want it in.
If you don’t know how to do that, I write about it briefly in my Drupal 8 “Block” views do not show up on Blocks page article.
In summary, if you’re trying to configure the Drupal “Similar By Terms” module, I hope this is helpful.