This project is read-only.

Related Content Module

Topics: Customizing Orchard, Writing modules
Nov 2, 2013 at 7:06 PM
Hello everyone,

I am considering building a "Related Content" widget. It will display a list of content items based on some property of the page that is currently being viewed. Essentially, I think I am seeking to build a dynamic query.

For example, if the page being viewed is a taxonomy term (Taxonomy: "Region", Term: "Asia"), the widget could display a list of content that is tagged with that term. For example a UL titled "Articles about this region:"

A projection and query seem perfect for this, the problem is that queries appear to be statically defined. Meaning, I can create a query for Taxonomy.Term = 'Asia' at design-time, but not Taxonomy.Term = '{CurrentPage.Region}' to evaluate at run-time.

To avoid creating lots of widgets or administrative overhead for content editors, static queries and multi-item content pickers are not viable solutions, it must be data-driven at runtime.

I did some Googling for a while, and it seems like others have had this question from time to time, with no definitive answers yet that I could find. It even looks like someone started to write a module for it, but may not have had time to go all the way with it. I would be happy to write up a tutorial for everyone and/or submit a module back to the community on it, but would appreciate some guidance on what methods (if any) there are to accomplish this in Orchard so I can design it properly ahead of time. Can use 1.6 or 1.7.

Thanks in advance for any advice!
Nov 2, 2013 at 8:55 PM
How about simply using projections?
Nov 2, 2013 at 10:56 PM
Edited Nov 3, 2013 at 12:51 PM
Exactly. :) Is anyone aware of anything in Orchard that could get this done with a projection?

It seems to do this with a projection it would need dynamic queries that can be constructed at runtime. However, since that looks like it would involve overhauling the entire query feature, I was wondering if maybe I am overlooking some other obvious simpler approach.

Any ideas are appreciated.

Thanks again!