Sooner or later most site developers are going to want to include related content--the articles most relevant to the content being viewed. Here are some quick notes on approaches to related content in Drupal 7.
Inferred or curated relationships?
The first distinction to make is between two types of related content.
- Curated relationships that are directly designated by site administrators.
- Inferred relationships that can be determined from available information. For example, a solution might use keyword analysis to determine content that has similar keywords and therefore is implicitly related.
A curated relationship is an explicit link created between two pieces of content.
Less precise than an explicit relationship is the taxonomy system, which allows content to be assigned to shared categories.
The taxonomy system is used to classify content. A simple approach to related content might create a number of vocabularies, assign them terms, and then classify content with those terms. From there it's relatively straightforward to display, alongside a piece of content, other content tagged with the same term or terms. See e.g. these tips for creating a view of related content.
The traditional solution for mapping explicit content relationships in Drupal is Node reference. For Drupal 7 it's packaged in the References module. See this tutorial for tips on displaying node reference-based related content using Views and Panels.
While it's tried and true, Node reference has a number of longstanding challenges. These include:
- The relationship mapped by node reference is necessarily one-way. Since the reference is a field that's added to a given content type, it's a property of only one of the pieces of content--the one that has the field. Depending on the type of relationship, this fact can create challenges when displaying related content; there's no easy way to mix "content this node references" and "content that references this node", even though the two may both be "content related to this node".
- The module doesn't allow a relationship to have any properties. For example, if an individual is associated with an organization, we can't store the date of joining as part of the relationship.
- The workflow of adding a reference can be cumbersome if the item you need to link to doesn't yet exist. For example, if you are adding an author and listing her publications, but have not yet entered the publications, by default you can't continue--you must first create the publications as separate content and then return to edit or create the user.
In Drupal 7, the Relation module is being written to try to address some of these issues.
Many sites, especially larger ones, are being built on Solr as a search solution, using mainly the Apache Solr search integration module.
While the main incentives for using Solr tend to be superior performance and advanced faceted search solutions, related content can be a valuable side benefit. The Apache Solr search integration module offers a related content block, with matches generated on the basis of complex analysis of the structured data sent to the Solr index.
The Recommender API offers another algorithm-based approach to determining relevant content.
There's a useful comparison page on some of the related content modules available on drupal.org.