Builds Razor views in Orchard Core themes and modules. Covers _ViewImports.cshtml setup, layout rendering with RenderBodyAsync and RenderSectionAsync, zone/shape/resource/media/datetime tag helpers, dynamic cache, and IOrchardHelper extensions.
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.
Every Orchard Core theme or module should include a _ViewImports.cshtml file at the root of its Views folder.
@inherits OrchardCore.DisplayManagement.Razor.RazorPage<TModel>
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, OrchardCore.DisplayManagement
@addTagHelper *, OrchardCore.ResourceManagement
@addTagHelper *, OrchardCore.Menu
@addTagHelper *, OrchardCore.Contents.TagHelpers
@addTagHelper *, OrchardCore.Media
@addTagHelper *, OrchardCore.DynamicCache
@using OrchardCore.DisplayManagement
@using OrchardCore.DisplayManagement.Shapes
@using OrchardCore.ContentManagement
@using Microsoft.AspNetCore.Html
@inherits OrchardCore.DisplayManagement.Razor.RazorPage<TModel> gives access to Orchard (IOrchardDisplayHelper), New, DisplayAsync, Site, T, ThemeLayout, and the title helpers. Do not @inject another Orchard property.@addTagHelper lines for assemblies your theme or module actually uses, and reference the matching packages (for example OrchardCore.ResourceManagement and OrchardCore.Contents.TagHelpers).@using OrchardCore.DisplayManagement.Razor is not needed when @inherits already references that namespace.@using OrchardCore directive is needed to access content helpers from IOrchardHelper.@{
Layout = "Layout";
}
_ViewStart.cshtml in the Views folder to set the default layout."Layout" references the shape named Layout which resolves to Layout.cshtml (or Layout.liquid) in the active theme._ViewStart.cshtml because their views render inside the theme's layout automatically.Layout = null; for partial or layoutless pages.A theme's Layout.cshtml renders the zones of the Layout shape with RenderSectionAsync and the main content with RenderBodyAsync. The <zone> tag helper does the opposite: it adds content to a zone and renders nothing where it is declared.
<!DOCTYPE html>
<html lang="@Orchard.CultureName()" dir="@Orchard.CultureDir()">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@RenderTitleSegments(Site.SiteName, "before")</title>
<style asp-name="bootstrap" version="5" at="Head"></style>
<style asp-name="{{ThemeStyleName}}" at="Head"></style>
<script asp-name="bootstrap" version="5" at="Foot"></script>
<resources type="Header" />
@await RenderSectionAsync("HeadMeta", required: false)
</head>
<body>
@await RenderSectionAsync("Header", required: false)
<main class="container">
@await RenderSectionAsync("Messages", required: false)
@await RenderBodyAsync()
</main>
@if (IsSectionDefined("Footer"))
{
<footer>
@await RenderSectionAsync("Footer", required: false)
</footer>
}
<resources type="FootScript" />
</body>
</html>
@await RenderBodyAsync() renders the Content zone of the layout. @await RenderSectionAsync("Name", required: false) renders any other zone; IsSectionDefined("Name") checks whether it has content.<resources type="Header" />. Pre-render them into a variable at the top of the layout when they appear after the head, as TheTheme does with its navbar.<resources type="Header" /> renders Meta, HeadLink, Stylesheet, and HeadScript in one call. You can also render them individually.<resources type="FootScript" /> right before </body>.RenderTitleSegments(segment, position = "0", separator = null) adds a title segment and returns the full title; "before" places the site name before the page segments.jQuery implicitly. Front-end themes that need it must require it explicitly with <script asp-name="jQuery" at="Foot"></script>.Shapes are the fundamental rendering unit in Orchard Core. Use tag helpers to display and compose shapes.
<shape type="{{ShapeType}}" />
<shape type="{{ShapeType}}" prop-title="@item.Title" prop-content="@item.Content" />
prop- to pass typed values; plain attributes are passed as strings.<add-property name="content">...</add-property> inside <shape> to pass Razor markup as an IHtmlContent property.<metadata display-type="Summary"><add-alternate name="..." /><add-wrapper name="..." /></metadata> inside a shape tag helper to adjust metadata.When you have a shape object (e.g., from a zone or the shape factory), render it with DisplayAsync:
@await DisplayAsync(Model)
@await DisplayAsync(Model.Content)
<shape type="{{ShapeType}}" cache-id="{{unique-id}}" cache-fixed-duration="00:05:00" cache-tag="alias:main-menu" cache-context="user.roles" />
Supported cache attributes are cache-id, cache-context, cache-tag, cache-fixed-duration, and cache-sliding-duration. They require the OrchardCore.DynamicCache feature.
<zone> adds its child content to a layout zone (optionally at a position). Use it in any view to push markup into the layout:
<zone name="Footer" position="after">
<p class="small">@T["Rendered from a content template."]</p>
</zone>
Render the zone in the layout with @await RenderSectionAsync("Footer", required: false).
Common zone names: Header, Navigation, Messages, Content, Sidebar, Footer, HeadMeta, BeforeContent, AfterContent.
In Orchard Core views, prefer MVC tag helpers so link generation stays in the Razor template and remains route-aware.
<a asp-action="Edit" asp-controller="Admin" asp-area="MyModule" asp-route-id="@Model.ContentItemId">
@T["Edit"]
</a>
With @addTagHelper *, OrchardCore.Contents.TagHelpers:
<a display-for="@contentItem">@contentItem.DisplayText</a>
<a edit-for="@contentItem">@T["Edit"]</a>
<a admin-for="@contentItem">@T["Admin"]</a>
asp-action, asp-controller, and when needed asp-area instead of hard-coded application URLs.display-for/edit-for to link to content items instead of building URLs from AutoroutePart.@Url.Content("~/...") to generate application links in Orchard Core views.<form asp-action="Update" method="post">.If a URL must be generated outside the view, inject LinkGenerator and pass the current HttpContext so Orchard Core generates the correct route-aware URL.
using Microsoft.AspNetCore.Routing;
public sealed class AdminLinkService
{
private readonly LinkGenerator _linkGenerator;
public AdminLinkService(LinkGenerator linkGenerator)
{
_linkGenerator = linkGenerator;
}
public string? GetEditUrl(HttpContext httpContext, string contentItemId)
{
return _linkGenerator.GetPathByAction(
httpContext,
action: "Edit",
controller: "Admin",
values: new
{
area = "MyModule",
id = contentItemId,
});
}
}
<style asp-name="{{ResourceName}}" at="Head"></style>
<style asp-name="bootstrap" version="5" at="Head"></style>
<script asp-name="{{ResourceName}}" at="Foot"></script>
<script asp-name="{{ResourceName}}" at="Head"></script>
<script at="Foot">
document.addEventListener('DOMContentLoaded', function () {
console.log('Page loaded');
});
</script>
<script asp-name="{{ResourceName}}" asp-src="~/{{ThemeName}}/js/site.min.js" debug-src="~/{{ThemeName}}/js/site.js" depends-on="bootstrap:5" at="Foot"></script>
TheAdmin no longer includes bootstrap-select styles automatically. Admin views that use it must require both:
<style asp-name="bootstrap-select" at="Head"></style>
<script asp-name="bootstrap-select" at="Foot"></script>
Place these in the layout to output all resources registered by shapes and modules:
<resources type="Header" />
<resources type="FootScript" />
type | Output |
|---|---|
Meta, HeadLink, Stylesheet, HeadScript | Individual head sections |
Header | All four head sections |
FootScript | Scripts registered with at="Foot" |
See orchardcore-resources for the complete resource manager guidance.
<img asset-src="@imagePath" alt="@altText" />
<img asset-src="@imagePath" img-width="300" />
<img asset-src="@imagePath" img-width="800" img-height="600" img-resize-mode="Crop" />
| Mode | Description |
|---|---|
Pad | Resize and pad to fit the target dimensions |
BoxPad | Pad the image to fit within the bounding box |
Crop | Resize and crop to fill the target dimensions |
Min | Resize to the minimum of the target dimensions |
Max | Resize to the maximum of the target dimensions |
Stretch | Stretch the image to fill the target dimensions |
See orchardcore-media for the full media tag helper and image processing reference.
<contentitem alias="alias:{{alias}}" display-type="Summary" />
@await Orchard.DisplayAsync(contentItem, "Summary")
| Display Type | Description |
|---|---|
Detail | Full detail view |
Summary | Abbreviated summary view |
SummaryAdmin | Admin list row (List layout) |
SummaryAdminGrid | Admin list card (Grid layout) |
<menu alias="alias:main-menu" cache-id="main-menu" cache-fixed-duration="00:05:00" cache-tag="alias:main-menu" cache-context="user.roles" />
alias attribute specifies the alias of the menu content item.Use Orchard's <dynamic-cache> tag helper (feature OrchardCore.DynamicCache), not ASP.NET Core's <cache>, so entries are tenant-aware and invalidated by Orchard dependencies. Require scripts and styles outside the cached block: code inside it does not run on a cache hit.
<dynamic-cache cache-id="recent-posts" vary-by="route" dependencies="alias:recent-posts" expires-after="00:10:00">
@await DisplayAsync(Model.Content)
</dynamic-cache>
| Attribute | Description |
|---|---|
cache-id | Required identifier of the cached section |
vary-by | Space/comma-separated cache contexts (user, user.roles, route, query:page, ...) |
dependencies | Space/comma-separated invalidation tags (contentitemid:{id}, alias:{alias}) |
expires-after | Relative expiration |
expires-on | Absolute DateTimeOffset expiration |
expires-sliding | Sliding expiration (default 30 seconds when nothing is set) |
Use <cache-dependency dependency="contentitemid:@item.ContentItemId" /> inside a cached block to add dependencies discovered while rendering. See orchardcore-dynamic-cache.
<datetime utc="@Model.ContentItem.CreatedUtc" />
<datetime utc="@Model.ContentItem.PublishedUtc" format="MMMM dd, yyyy" />
<timespan utc="@Model.ContentItem.CreatedUtc" />
Access IOrchardHelper via the Orchard property in Razor views that inherit from OrchardCore.DisplayManagement.Razor.RazorPage<TModel>.
Content helpers live in ContentOrchardHelperExtensions and are available without adding @using OrchardCore.
@{
var item = await Orchard.GetContentItemByIdAsync("{{contentItemId}}");
}
@{
var items = await Orchard.GetContentItemsByIdAsync(ids);
}
@{
var item = await Orchard.GetContentItemByVersionIdAsync("{{contentItemVersionId}}");
}
@{
var items = await Orchard.QueryContentItemsAsync(query =>
query.Where(index => index.ContentType == "BlogPost" && index.Published));
}
@{
var items = await Orchard.GetRecentContentItemsByContentTypeAsync("BlogPost", 10);
}
@{
var item = await Orchard.GetContentItemByHandleAsync("alias:{{alias}}");
}
Access global site settings via Site:
<p>@Site.SiteName</p>
<p>@Site.BaseUrl</p>
@Orchard.ConsoleLog(Model.ContentItem)
@await Orchard.LiquidToHtmlAsync("{{ 'now' | date: '%B %d, %Y' }}")
Only render Liquid that comes from trusted code or from users with the ManageLiquidTemplates permission. HtmlBodyPart, HtmlField, MarkdownBodyPart, and MarkdownField no longer run Liquid in Orchard Core 4.0; use LiquidPart or LiquidField for authored Liquid.
@await Orchard.MarkdownToHtmlAsync(markdown)
@await Orchard.MarkdownToHtmlAsync(markdown, sanitize: false)
The renderLiquid parameter was removed in 4.0.
Register stylesheets and scripts so they can be referenced by name in Razor views. See orchardcore-resources for CDN, integrity, and dependency configuration.
using Microsoft.Extensions.Options;
using OrchardCore.ResourceManagement;
public sealed class ResourceManagementOptionsConfiguration
: IConfigureOptions<ResourceManagementOptions>
{
private static readonly ResourceManifest _manifest;
static ResourceManagementOptionsConfiguration()
{
_manifest = new ResourceManifest();
_manifest.DefineStyle("{{ThemeStyleName}}")
.SetUrl("~/{{ModuleOrThemeId}}/css/site.min.css", "~/{{ModuleOrThemeId}}/css/site.css")
.SetDependencies("bootstrap:5")
.SetVersion("1.0.0");
_manifest.DefineScript("{{ThemeScriptName}}")
.SetUrl("~/{{ModuleOrThemeId}}/js/site.min.js", "~/{{ModuleOrThemeId}}/js/site.js")
.SetDependencies("bootstrap:5")
.SetVersion("1.0.0");
}
public void Configure(ResourceManagementOptions options)
{
options.ResourceManifests.Add(_manifest);
}
}
SetUrl parameter is the minified version; the second is the debug version.at="Foot" / at="Head"). SetPosition(ResourcePosition.First | Last | ByDependency) only changes ordering, not the head/foot location.SetDependencies("name") or SetDependencies("name:version") to declare dependencies.Startup.cs:public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddResourceConfiguration<ResourceManagementOptionsConfiguration>();
}
}
{
"steps": [
{
"name": "Themes",
"Site": "{{ThemeId}}",
"Admin": "TheAdmin"
}
]
}
Official Orchard Core videos shown on the documentation page:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
140 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./orchardcore:orchardcore-razorfrom orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin orchardcoreOther plugins' skills for the same job