How to dynamically display a "featured article" widget on a taxonomy page?

Topics: Customizing Orchard
Nov 30, 2015 at 1:24 AM
Edited Nov 30, 2015 at 2:32 AM
Hello all,

I am trying to display a "featured article" widget on a generated taxonomy page using a projection in Orchard 1.8.2

Some Background:
I have a taxonomy called "TaxonomyNavigations" that is currently a list of countries, nested in regions eg so you can create breadcrumbs & index pages like:
Worldwide / Europe / Germany

I am using the IvyExcellence.HierarchicalUrls module to use that taxonomy to populates the routes of an article. It adds a taxonomy field called "Channels" which is not visible in the UI after the initial creation of the article. If you export the article you can see it in the data like <TaxonomyField.Channels Terms="/Identifier=c4cc802ff3a74c38bdc60472c63c4f13/TermCode=TaxonomyNavigationsTerm\/DEU" />

I have a layer rule that uses Contenttype ("TaxonomyNavigationsTerm"), which allows me to put a widget on ALL the generated Taxonomy index pages.

I have added a boolean field called "FeaturedOnIndexPage" to the article content type, so i can flag which article(s) I want to appear on the index page.

I am trying to make a single query that will use a projection widget to dynamically display the featured article(s) on taxonomy pages that have the matching taxonomy

ie: an article with a taxonomy of "germany" and a url of "worldwide/europe/germany/my-featured-article", that has it's FeaturedOnIndexPage flag checked, gets displayed in a widget on the " worldwide/europe/germany" taxonomy page - but not on the "worldwide/europe/" or "worldwide" taxonomy pages.

Similarly, an article with a url of "worldwide/europe/spain/my-featured-spanish-article", that has it's FeaturedOnIndexPage flag checked, gets displayed in a widget on the " worldwide/europe/ spain " taxonomy page - but not on the "worldwide/europe/" or "worldwide" taxonomy pages.

My query filters currently go
Content with type Article
Article. FeaturedOnIndexPage is true

(And where I am getting stuck with what values I should be matching)
Has Same Terms As Content Item
  • Source content item id = {Context.This.TaxonomyField.Terms} (have also tried {Context.This.Id} )
  • Taxonomy Field Name = {Content.Fields.AutoroutePart.Channels.Terms}
I have also tried matching on the title of the taxonomy page
{Context.This.DisplayText} gives you the title of the taxonomypage eg: "Germany"
{Content.Fields.AutoroutePart.Channels.Terms} gives you the taxonomy term name in the autoroute you selected eg: "Germany"

I'm sure there is a way you can do this, as it is basically an extension of the default behavior of the taxonomy page to display a summary of all the articles with that taxonomy term,
but can you do it in a projection?

Any help would be appreciated.

Cheers,