# Orchardcore Taxonomies

> Skill for creating and managing taxonomies in Orchard Core. Covers taxonomy creation, taxonomy terms, taxonomy fields, and taxonomy-based content organization. Use this skill when requests mention Orchard Core Taxonomies, Create and Manage Taxonomies, Enabling Taxonomy Features, Creating a Taxonomy via Recipe, Hierarchical Terms (Nested), Attaching TaxonomyField to a Content Type, or closely related Orchard Core implementation, setup, extension, or troubleshooting work. Strong matches include work with OrchardCore.Taxonomies, TaxonomyField, TermPart, TitlePart, AliasPart, TaxonomyPart, AlterPartDefinition, WithField, WithSettings, TaxonomyFieldSettings, AlterTypeDefinition, WithPart. It also helps with taxonomy examples, Hierarchical Terms (Nested), Attaching TaxonomyField to a Content Type, Querying by Taxonomy Terms in Liquid, plus the code patterns, admin flows, recipe steps, and referenced examples captured in this skill.

- Skill: `crestapps/orchardcore-taxonomies` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add crestapps/orchardcore-taxonomies`
- Raw SKILL.md: https://api.skillmd.com/api/skills/crestapps/orchardcore-taxonomies/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: Apache-2.0
- Author: CrestApps (https://skillmd.com/u/crestapps)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/crestapps/orchardcore-taxonomies

---


# Orchard Core Taxonomies - Prompt Templates

## Create and Manage Taxonomies

You are an Orchard Core expert. Generate taxonomy definitions, terms, and taxonomy field configurations.

### Guidelines

- Enable `OrchardCore.Taxonomies` to use taxonomy features.
- A Taxonomy is a content item of type `Taxonomy` that contains terms.
- Terms are hierarchical content items within a taxonomy.
- Use `TaxonomyField` on content types to allow categorization.
- Taxonomies can be flat (tags) or hierarchical (categories).
- Terms can have custom content parts and fields.
- `TermPart` is welded automatically onto content items used as taxonomy terms; do not attach it manually.
- Taxonomy content listings use full pagination in Orchard Core 3.0.

### Enabling Taxonomy Features

```json
{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "OrchardCore.Taxonomies"
      ],
      "disable": []
    }
  ]
}
```

### Creating a Taxonomy via Recipe

```json
{
  "steps": [
    {
      "name": "Content",
      "data": [
        {
          "ContentItemId": "{{TaxonomyId}}",
          "ContentType": "Taxonomy",
          "DisplayText": "{{TaxonomyName}}",
          "Latest": true,
          "Published": true,
          "TitlePart": {
            "Title": "{{TaxonomyName}}"
          },
          "AliasPart": {
            "Alias": "{{taxonomy-alias}}"
          },
          "TaxonomyPart": {
            "Terms": [
              {
                "ContentItemId": "{{TermId1}}",
                "ContentType": "{{TermContentType}}",
                "DisplayText": "{{TermName1}}",
                "TitlePart": {
                  "Title": "{{TermName1}}"
                }
              },
              {
                "ContentItemId": "{{TermId2}}",
                "ContentType": "{{TermContentType}}",
                "DisplayText": "{{TermName2}}",
                "TitlePart": {
                  "Title": "{{TermName2}}"
                }
              }
            ],
            "TermContentType": "{{TermContentType}}"
          }
        }
      ]
    }
  ]
}
```

### Hierarchical Terms (Nested)

```json
{
  "ContentItemId": "term-parent",
  "ContentType": "Category",
  "DisplayText": "Parent Category",
  "TitlePart": {
    "Title": "Parent Category"
  },
  "Terms": [
    {
      "ContentItemId": "term-child-1",
      "ContentType": "Category",
      "DisplayText": "Child Category 1",
      "TitlePart": {
        "Title": "Child Category 1"
      }
    },
    {
      "ContentItemId": "term-child-2",
      "ContentType": "Category",
      "DisplayText": "Child Category 2",
      "TitlePart": {
        "Title": "Child Category 2"
      }
    }
  ]
}
```

### Attaching TaxonomyField to a Content Type

```csharp
_contentDefinitionManager.AlterPartDefinition("BlogPost", part => part
    .WithField("Categories", field => field
        .OfType("TaxonomyField")
        .WithDisplayName("Categories")
        .WithSettings(new TaxonomyFieldSettings
        {
            TaxonomyContentItemId = "{{TaxonomyContentItemId}}",
            Unique = false,
            LeavesOnly = false
        })
        .WithPosition("0")
    )
    .WithField("Tags", field => field
        .OfType("TaxonomyField")
        .WithDisplayName("Tags")
        .WithEditor("Tags")
        .WithSettings(new TaxonomyFieldSettings
        {
            TaxonomyContentItemId = "{{TagsTaxonomyContentItemId}}"
        })
        .WithPosition("1")
    )
);
```

### Querying by Taxonomy Terms in Liquid

Create a SQL query named `ContentItemsByTaxonomyTerm` with **Return Content Items** disabled:

```sql
SELECT DISTINCT ContentItemId
FROM TaxonomyIndex
WHERE TermContentItemId = @termContentItemId:''
  AND Published = true
```

Execute the query, then load its returned content item ids with the `content_item_id` filter:

```liquid
{% assign rows = Queries.ContentItemsByTaxonomyTerm | query: termContentItemId: termId %}
{% assign contentItemIds = rows | map: "ContentItemId" %}
{% assign items = contentItemIds | content_item_id %}

{% for item in items %}
    {{ item | display_text }}
{% endfor %}
```

### Filtering Taxonomy Content Listings

Implement `IContentsTaxonomyListFilter` when a module must add restrictions
to the query used by a taxonomy term content listing. Keep the filter
focused on query constraints and let the built-in listing handle paging.

### Displaying Taxonomy Terms

```liquid
{% assign terms = Model.ContentItem.Content.BlogPost.Categories | taxonomy_terms %}
{% for term in terms %}
    <span class="badge">{{ term.DisplayText }}</span>
{% endfor %}
```

### Custom Term Content Type

Create a custom term type with additional fields:

```csharp
await _contentDefinitionManager.AlterTypeDefinitionAsync("Category", type => type
    .DisplayedAs("Category")
    .WithPart("TitlePart")
    .WithPart("Category", part => part
        .WithPosition("1")
    )
);

await _contentDefinitionManager.AlterPartDefinitionAsync("Category", part => part
    .WithField("Icon", field => field
        .OfType("TextField")
        .WithDisplayName("Icon CSS Class")
        .WithPosition("0")
    )
    .WithField("Description", field => field
        .OfType("TextField")
        .WithDisplayName("Description")
        .WithEditor("TextArea")
        .WithPosition("1")
    )
);
```

