Provides guidance on Orchard Core's shape system including creation, Liquid/Razor templates, alternates, wrappers, metadata, and rendering. Useful when building or troubleshooting display templates.
Ships in orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an Orchard Core expert. Generate shape templates, shape providers, and shape-related code for Orchard Core.
Content, Widget, TextField), metadata, and properties..liquid) or Razor (.cshtml). Both use the same file naming rules._ and __) in C#, placement.json, and shape metadata. Use dots and hyphens only in template file names.DisplayDriver<T>.Edit() flows, remember the root editor shape for the model type as well as any nested field/editor shapes. If BuildEditorAsync() is used for TableauExportPipeline, Orchard will resolve a root TableauExportPipeline_Edit shape in addition to shapes like TableauExportPipelineFields_Edit.*.Edit.cshtml including site settings editors), shape templates should use the ocat-* (Orchard Core Admin Theme) CSS classes for consistent field layout: ocat-wrapper for the outer row, ocat-label for labels, ocat-end for the input column, ocat-end-offset for checkbox-only layouts/headings/buttons, ocat-limited-wrapper + ocat-limited for narrower inputs.@Orchard.GetWrapperClasses(), @Orchard.GetLabelClasses(), @Orchard.GetEndClasses() helper methods and TheAdminThemeOptions class have been removed. Use the static ocat-* CSS classes directly. Do NOT use these classes in frontend views or Admin Menu node editing.IShapeFactory creates shapes dynamically from code; IDisplayHelper renders them inside a view; IShapeHtmlRenderer renders them to a string outside of a view.IShapeTableProvider customizes shape behavior (alternates, wrappers, bindings).IDisplayManager<T> orchestrates building and rendering shapes for content.Shapes are objects that carry data and metadata for rendering. The rendering pipeline:
IDisplayResult (usually a ShapeResult).IShapeFactory and adds it to the selected zone.Displaying handlers run, then the binding is resolved by checking alternates from highest to lowest priority, then the shape type and its __ fallbacks.[Shape] method) renders the shape, then wrappers render around its ChildContent.If no binding can be resolved, rendering throws an InvalidOperationException naming the missing shape type and active theme.
Every shape has a Metadata property (ShapeMetadata) with:
Type — The logical shape type used for binding resolution (not the CLR type).DisplayType — The display context (e.g., Detail, Summary, Edit).Alternates — Ordered alternate binding names; the last added has the highest priority.Wrappers — Shape types rendered around this shape; the first added is the innermost.Name / Differentiator — Identify the shape inside its parent and among reused shape types.Position — The position within a zone.Prefix — HTML field prefix used while rendering editors.TabGrouping, CardGrouping, ColumnGrouping — Editor grouping set by placement.PlacementSource — Where the placement rule came from.ChildContent — The rendered output so far (set by the binding, cache, or wrappers). Do not use it as input data.| Canonical binding name | Razor or Liquid file name |
|---|---|
Content | Content.cshtml / Content.liquid |
Content__BlogPost | Content-BlogPost.cshtml / .liquid |
Content_Summary__BlogPost | Content-BlogPost.Summary.cshtml / .liquid |
Content_Summary | Content.Summary.cshtml / .liquid |
Widget__HeroBanner | Widget-HeroBanner.cshtml / .liquid |
Fields_Common_Text__FirstName | Views/Fields/Common.Text-FirstName.cshtml / .liquid |
Rules:
- becomes __ (breaking separator, creates fallback levels); . becomes _.__: Content-BlogPost.Summary → Content_Summary__BlogPost.Views, Views/Items, Views/Parts, Views/Fields, and Views/Elements; the last three add Parts_, Fields_, or Elements_ prefixes.Content__BlogPost__Summary.liquid does not match the summary alternate; use Content-BlogPost.Summary.liquid.<article>
<header>
{{ Model.Header | shape_render }}
</header>
{{ Model.Content | shape_render }}
<footer>
{{ Model.Footer | shape_render }}
</footer>
</article>
<article>
<header>
@await DisplayAsync(Model.Header)
</header>
@await DisplayAsync(Model.Content)
<footer>
@await DisplayAsync(Model.Footer)
</footer>
</article>
When a DisplayDriver<T> editor is built through IDisplayManager<T>.BuildEditorAsync() or UpdateEditorAsync(), Orchard also resolves a root editor shape for the model type. That root template usually just renders the editor zones populated by nested shapes:
@await DisplayAsync(Model.Content)
Without this wrapper, Orchard throws an InvalidOperationException saying the root shape type (for example TableauExportPipeline_Edit) was not found.
Alternates let more specific templates override generic ones. Alternates added later win; do not add the base type itself as an alternate.
For a Content shape displaying a BlogPost content type in Summary display type, the resolver checks (most specific first):
| Alternate | File Name |
|---|---|
Content_Summary__BlogPost | Content-BlogPost.Summary.cshtml / .liquid |
Content__BlogPost | Content-BlogPost.cshtml / .liquid |
Content_Summary | Content.Summary.cshtml / .liquid |
Content (base) | Content.cshtml / .liquid |
Other content alternates include Content__Alias__[Alias], Content__Slug__[Slug], and their display-type variants. See orchardcore-templates for the full alternate catalog.
Shape types containing __ also fall back by removing the last segment: Car__Toyota__Hybrid → Car__Toyota → Car.
<!-- Create and render a shape by type, with properties -->
{% shape "ShapeName", prop1: "value1", prop2: "value2" %}
<!-- Create, populate, then render -->
{% assign car = "Car" | shape_new %}
{% shape_add_properties car brand: "Toyota", color: "Blue" %}
{{ car | shape_render }}
<!-- Render a shape object or a zone of the current shape -->
{{ Model.Content | shape_render }}
{{ Model.Header | shape_render }}
<!-- Render a content item with a display type -->
{{ Model.ContentItem | shape_build_display: "Summary" | shape_render }}
In a Liquid layout, render layout zones with {% render_section "Header", required: false %} and the body with {% render_body %}. The {% zone "Footer" %}...{% endzone %} block adds markup to a layout zone; it does not render it.
<!-- Render all shapes in the Content zone -->
{{ Model.Content | shape_render }}
<!-- Render a specific part's shape -->
{{ Model.Content.TitlePart | shape_render }}
{{ Model.Content.HtmlBodyPart | shape_render }}
<!-- Remove one shape by name before rendering the zone -->
{% shape_remove_item Model.Content "HtmlBodyPart" %}
{{ Model.Content | shape_render }}
{% for item in Model.Content %}
{{ item | shape_render }}
{% endfor %}
{% if Model.Content.TitlePart %}
<h1>{{ Model.Content.TitlePart | shape_render }}</h1>
{% endif %}
{% if Model.Footer %}
<footer>{{ Model.Footer | shape_render }}</footer>
{% endif %}
@* Render a zone of the current shape *@
@await DisplayAsync(Model.Content)
@await DisplayAsync(Model.Header)
@* Render a specific part shape *@
@await DisplayAsync(Model.Content.TitlePart)
@* Create and render an ad-hoc shape *@
@{
var shape = await New.MyCustomShape(Property1: "value1");
}
@await DisplayAsync(shape)
@* Tag helper form *@
<shape type="MyCustomShape" prop-property1="value1" />
Use DisplayAsAsync to render an existing shape as another logical type. It clears alternates by default and changes Metadata.Type on the same instance:
@await DisplayAsAsync(Model, "CompactCar")
@await DisplayAsAsync(Model, "CompactCar", clearAlternates: false)
using OrchardCore.DisplayManagement;
public sealed class MyService
{
private readonly IShapeFactory _shapeFactory;
private readonly IShapeHtmlRenderer _shapeHtmlRenderer;
public MyService(IShapeFactory shapeFactory, IShapeHtmlRenderer shapeHtmlRenderer)
{
_shapeFactory = shapeFactory;
_shapeHtmlRenderer = shapeHtmlRenderer;
}
public async Task<IShape> CreateCustomShapeAsync()
{
// Dynamic shape with copied properties, rendered by "MyCustomShape" templates.
return await _shapeFactory.CreateAsync("MyCustomShape", Arguments.From(new
{
Title = "Hello",
Description = "World",
}));
}
public async Task<IShape> CreateTypedShapeAsync()
{
// Strongly typed shape: the model must be a non-sealed class (a proxy derives from it).
return await _shapeFactory.CreateAsync<CarViewModel>("Car", car =>
{
car.Brand = "Toyota";
car.Color = "Blue";
});
}
// Outside of a view (API endpoint, background-rendered fragment, JSON response).
public async Task<string> RenderCustomShapeAsync(CancellationToken cancellationToken)
=> await _shapeHtmlRenderer.RenderAsync(await CreateCustomShapeAsync(), cancellationToken);
}
Inside a view, render with @await DisplayAsync(shape). Never call IDisplayHelper from an endpoint without a view; use IShapeHtmlRenderer instead (RenderAsync or RenderZoneAsync(shape, "Content")).
Display drivers create shapes using Initialize<TModel>:
public sealed class MyPartDisplayDriver : ContentPartDisplayDriver<MyPart>
{
public override IDisplayResult Display(MyPart part, BuildPartDisplayContext context)
{
return Initialize<MyPartViewModel, MyPart>("MyPart", static (model, part) =>
{
model.Text = part.Text;
model.ContentItem = part.ContentItem;
}, part)
.Location("Detail", "Content:5")
.Location("Summary", "Content:5");
}
}
See orchardcore-display-management for every ShapeResult helper (Initialize, Dynamic, Copy, View, Factory, Combine) and the 4.0 typed-state and ValueTask overloads.
If your driver returns nested editor shapes like Initialize<MyViewModel>("MyTypeFields_Edit", ...), also add the root editor template for the model type used by BuildEditorAsync():
public sealed class MyTypeDisplayDriver : DisplayDriver<MyType>
{
internal readonly IStringLocalizer S;
public MyTypeDisplayDriver(IStringLocalizer<MyTypeDisplayDriver> stringLocalizer)
{
S = stringLocalizer;
}
public override IDisplayResult Edit(MyType model, BuildEditorContext context)
{
return Initialize<MyTypeViewModel>("MyTypeFields_Edit", viewModel =>
{
viewModel.Name = model.Name;
})
.Location(l => l.Zone("Content", "1").Card(S["General"], "10"));
}
}
@* Views/MyType.Edit.cshtml *@
@await DisplayAsync(Model.Content)
@* Views/MyTypeFields.Edit.cshtml: rows only, the card comes from the location *@
@model MyTypeViewModel
<div class="ocat-wrapper" asp-validation-class-for="Name">
<label asp-for="Name" class="ocat-label ocat-label-required">@T["Name"]</label>
<div class="ocat-end">
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name"></span>
</div>
</div>
This split keeps the model-level wrapper and the field editor template aligned with Orchard's shape resolution rules.
public override IDisplayResult Display(MyPart part, BuildPartDisplayContext context)
{
return Combine(
Initialize<MyPartViewModel>("MyPart", model =>
{
model.Text = part.Text;
}).Location("Detail", "Content:5"),
Initialize<MyPartSummaryViewModel>("MyPart_Summary", model =>
{
model.Summary = part.Summary;
}).Location("Summary", "Content:5"),
Dynamic("MyPart_Actions")
.Location("SummaryAdmin", "Actions:5")
);
}
Create shapes without a specific view model:
public override IDisplayResult Display(MyPart part, BuildPartDisplayContext context)
{
return Dynamic("MyPart_Badge", shape =>
{
shape.Text = part.BadgeText;
shape.CssClass = part.IsActive ? "active" : "inactive";
})
.Location("Detail", "Meta:5");
}
IShapeTableProvider lets you customize shape behavior globally. The shape table is built once per tenant and theme, so only register behavior (handlers, bindings) there; never resolve request data or register resources inside DiscoverAsync.
using OrchardCore.DisplayManagement.Descriptors;
public sealed class CarShapeTableProvider : IShapeTableProvider
{
public ValueTask DiscoverAsync(ShapeTableBuilder builder)
{
builder.Describe("Car")
.OnDisplaying(context =>
{
if (context.Shape is CarViewModel car)
{
// Least specific first: the last added alternate wins.
context.Shape.Metadata.Alternates.Add($"Car_Color__{car.Color}");
context.Shape.Metadata.Alternates.Add($"Car_Brand__{car.Brand}");
}
});
return ValueTask.CompletedTask;
}
}
Values used in binding names should be controlled identifiers, not arbitrary user input.
public sealed class WidgetShapeTableProvider : IShapeTableProvider
{
public ValueTask DiscoverAsync(ShapeTableBuilder builder)
{
builder.Describe("Widget")
.OnDisplaying(context =>
{
// Wrap all widgets with the Widget_CardWrapper template.
context.Shape.Metadata.Wrappers.Add("Widget_CardWrapper");
});
return ValueTask.CompletedTask;
}
}
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddShapeTableProvider<CarShapeTableProvider>();
services.AddShapeTableProvider<WidgetShapeTableProvider>();
}
}
A wrapper receives the same shape; Model.Metadata.ChildContent holds the output rendered so far. Never call DisplayAsync(Model) or shape_render on Model inside a wrapper, which re-renders the shape recursively.
<div class="card widget-{{ Model.ContentItem.ContentType | downcase }}">
<div class="card-body">
{{ Model.Metadata.ChildContent }}
</div>
</div>
<div class="card">
<div class="card-body">
@Model.Metadata.ChildContent
</div>
</div>
Wrappers can also be added from placement.json ("wrappers": [ "Widget_CardWrapper" ]) or the <add-wrapper> metadata tag helper.
[Shape]using Microsoft.AspNetCore.Html;
using OrchardCore.DisplayManagement;
using OrchardCore.DisplayManagement.Descriptors;
public sealed class CarShapes : IShapeAttributeProvider
{
[Shape("Car")]
public IHtmlContent Car(IShape Shape)
{
var car = (CarViewModel)Shape;
var tagBuilder = Shape.GetTagBuilder("div");
tagBuilder.InnerHtml.Append($"A {car.Color} {car.Brand} car.");
return tagBuilder;
}
}
Register with services.AddShapeAttributes<CarShapes>();.
ILayoutAccessor.GetLayoutAsync() returns the request's Layout shape; its zones are Zone shapes created on demand.ContentZone zones, which build tab, card, and column grouping shapes when children carry grouping metadata.await shape.AddAsync(child, "5") adds a positioned item. Positions sort numerically and hierarchically: start < before < 0 (empty) < 1 < 1.1 < 2 < 10 < after < free text < end. Use start/end when an item must be truly first or last, including relative to free-text positions such as PrefixPosition() values.var layout = await _layoutAccessor.GetLayoutAsync();
var menu = await _shapeFactory.CreateAsync("Menu");
await layout.Zones["Header"].AddAsync(menu, "5");
| Shape Type | Description | Template |
|---|---|---|
Content | Main content item display | Content.liquid |
Content_Edit | Content item editor | Content.Edit.liquid |
Widget | Widget display wrapper | Widget.liquid |
Zone | Layout zone container | Zone.liquid |
MenuItem | Menu item rendering | MenuItem.liquid |
MenuItemLink | Menu item with link | MenuItemLink.liquid |
NavigationItem | Navigation item | NavigationItem.liquid |
List | List part container | List.liquid |
PagerSlim | Pagination controls | PagerSlim.liquid |
Pager | Full pagination | Pager.liquid |
TextField | Text field display | TextField.liquid |
HtmlField | HTML field display | HtmlField.liquid |
BooleanField | Boolean field display | BooleanField.liquid |
DateTimeField | DateTime field display | DateTimeField.liquid |
NumericField | Numeric field display | NumericField.liquid |
MediaField | Media field display | MediaField.liquid |
ContentPickerField | Content picker display | ContentPickerField.liquid |
TaxonomyField | Taxonomy field display | TaxonomyField.liquid |
LinkField | Link field display | LinkField.liquid |
CardContainer | The cards of an editor zone (GroupViewModel), rendered by the admin theme as div.ocat-cards | CardContainer.cshtml |
Card | One card of an editor zone (GroupingViewModel), a <fieldset> with a <legend> in TheAdmin | Card.cshtml |
AdminSchemePreview | TheAdmin's live light and dark preview of a scheme | AdminSchemePreview.cshtml |
Since 4.0 the field display templates (TextField, HtmlField, BooleanField, ...) render the field's display name in a <span class="name"> before the value, and {FieldType}.DetailAdmin.cshtml templates render fields in the DetailAdmin display type as admin rows; override a field template (for example {PartType}-{FieldName}) to drop the name (see orchardcore-content-fields).
<article class="content-item content-item-{{ Model.ContentItem.ContentType | downcase }}">
{% if Model.Header %}
<header>{{ Model.Header | shape_render }}</header>
{% endif %}
{% if Model.Meta %}
<div class="meta">{{ Model.Meta | shape_render }}</div>
{% endif %}
{{ Model.Content | shape_render }}
{% if Model.Footer %}
<footer>{{ Model.Footer | shape_render }}</footer>
{% endif %}
</article>
<article class="blog-post">
<header>
<h1>{{ Model.ContentItem.DisplayText }}</h1>
<time datetime="{{ Model.ContentItem.PublishedUtc | date: '%Y-%m-%d' }}">
{{ Model.ContentItem.PublishedUtc | date: "%B %d, %Y" }}
</time>
</header>
{{ Model.Content | shape_render }}
{% if Model.Footer %}
<footer class="post-footer">
{{ Model.Footer | shape_render }}
</footer>
{% endif %}
</article>
<div class="widget widget-{{ Model.ContentItem.ContentType | downcase }}">
<div class="widget-body">
{{ Model.Content | shape_render }}
</div>
</div>
<article class="content-summary">
<h3>
<a href="{{ Model.ContentItem | display_url }}">
{{ Model.ContentItem.DisplayText }}
</a>
</h3>
{% if Model.Meta %}
<div class="meta">{{ Model.Meta | shape_render }}</div>
{% endif %}
{{ Model.Content | shape_render }}
</article>
Enable Write shape debug information in the tenant's Settings → Debugging editor. Orchard Core applies that setting to ShapeRenderingOptions through IOptionsMonitor, so it takes effect without a shell release.
When enabled, each rendered shape is wrapped with comments like:
<!--shape-start type:Content bindings:Content__BlogPost => Views/Content-BlogPost.cshtml (razor) -->
...
<!--shape-end type:Content-->
The comment shows the shape type and the binding that won. To find slow shapes rather than template names, collect the OrchardCore.DisplayManagement activity source and meter (see orchardcore-display-management) or use orchardcore-mini-profiler.
When an override is not selected, check: the shape's Metadata.Type, DisplayType, and ordered Alternates; canonical name vs file name form; that the template is under a harvested Views folder; whether a later alternate wins; whether placement changed the shape type (which clears alternates and wrappers); and whether the active theme or startup project overrides the module binding.
What SKILL.md sets; muted values are Claude Code's defaults
/orchardcore:orchardcore-shapesfrom orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin orchardcore140 skills in this plugin
/orchardcore-adminGuidance for the Orchard Core admin panel, including admin controllers and routes, admin menu registration with AdminNavigationProvider, ocat editor forms grouped in cards, admin pages rendering Model.Editor, the UI text casing standard, TheAdmin layout and menu colors, admin branding, the Navbar shape, the Ctrl+K quick navigation palette and QuickNavigationSource, AdminSettings such as MenuBehavior, ShowBreadcrumb, DisplayQuickNavigation, DisplayTitlesInTopbar and ActionsLayout, the AdminDashboard shape, settings pages, and admin filters and zones. Use this skill when requests mention the Orchard Core admin panel, TheAdmin, admin controllers, admin menu registration, an icon on an admin menu item, the AdminSettings recipe step, quick navigation, navigation menu behavior, the admin URL prefix, UI text casing. Strong matches include OrchardCore.Admin, AdminSettings, AdminPermissions, AdminOptions, AdminAttribute, SiteDisplayDriver, IDisplayManager./orchardcore-admin-dashboardSkill for creating admin dashboard widgets in Orchard Core. Covers the DashboardWidget stereotype, DashboardPart position and sizing, the built-in HtmlDashboardWidget, ContentsMetadata and ContentsTags widget types, custom widget content types via recipe or migration, arranging widgets in Manage Dashboard mode, widget template customization, provisioning widgets with recipes, dashboard permissions, the DashboardBreadcrumbProvider Dashboard ancestor, and the AdminDashboardContent shape used when the feature is disabled. Use this skill when requests mention Orchard Core Admin Dashboard, Create and Configure Dashboard Widgets, Enabling Admin Dashboard, Widget Configuration Properties, dashboard widget recipes, Dashboard breadcrumb, or related implementation, setup, or troubleshooting work. Strong matches include OrchardCore.AdminDashboard, DashboardPart, DashboardBreadcrumbProvider, AccessAdminDashboard, ManageAdminDashboard.Other plugins' skills for the same job