I'm trying to display a List of my taxonomies with a count of content items in it.
But i can't find out how to do it. i tried to modify TaxonomyItem.cshtml
var terms = (IEnumerable<Orchard.Taxonomies.Models.TermPart>)Model.Taxonomy.TaxonomyPart.Terms;
@terms.Count()
but this gives my only the count of taxonomy items, not the count of content items inside each taxonomy.
how can i display this?
EDIT
Each term has the Count of ContentItems, is the Count value of TermPart.Count. Every time a content item is tagged with the term the TermsPartHandler refresh the count.
The TaxonomyItem template uses DisplayChildren, and for each Term it will render the template TaxonomyItemLink.
@*
This shape is displayed for a TermPart when in a Taxonomy details page.
Alternates:
- TaxonomyItemLink__[HtmlClassifiedTaxonomyName]
- TaxonomyItemLink__[HtmlClassifiedTaxonomyName]__[HtmlClassifiedTermName]
*@
@using Orchard.Taxonomies.Models
@{
TermPart part = Model.ContentPart;
}
<span> This is the number of content items with this Term @part.Count </span>
@Html.ItemDisplayLink(part)
That is the count of items for that Term, not the Taxonomy.