Provides guidance on Orchard Core content APIs including REST endpoints (GET, POST, DELETE), GraphQL queries, Liquid/Razor helpers, content lifecycle states, and API authentication.
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.
None: SKILL.md is the whole skill.
You are an Orchard Core expert. Generate code and configuration for accessing content items through REST API, GraphQL, Liquid, and Razor in Orchard Core.
OrchardCore.Contents module owns the REST endpoints and the AccessContentApi permission. GraphQL requires OrchardCore.Apis.GraphQL; Liquid and Razor helpers are separate display-management integrations.Api authentication scheme. Configure an API authentication provider, such as OpenID token validation, for that scheme. Cookie sessions are not accepted.ManageLiquidTemplates in 4.0.OrchardCore.Apis.GraphQL feature is enabled.Content object to load content items by alias, slug, ID, or version ID.Orchard Razor helper for content loading in .cshtml views.IContentManager.PublishAsync() only raises publishing events if the content item is a draft.{ "steps": [...] }.sealed modifier except View Models.| State | Description |
|---|---|
| Draft | Being worked on but not yet published. Only visible to editors. |
| Published | Live and visible to visitors. Has Published = true and Latest = true. |
| Unpublished | Removed from public view but stored in the system as a draft. |
| Removed | Soft-deleted. Invisible to all but restorable via Audit Trail module. |
| Cloned | Independent copy of an existing content item, created as a draft. |
| Scheduled | Set to be published or archived at a future date (via Publish Later / Archive Later). |
The Latest version is the most recent version, which may include unpublished changes.
Attach CommonPart to edit common properties of a content item:
| Property | Type | Description |
|---|---|---|
CreatedUtc | DateTime | When the content item was created |
Owner | string | The owner of the content item |
OrchardCore.Contents maps three minimal-API endpoints. All of them authenticate with the Api scheme (bearer tokens only, no cookies), skip anti-forgery, and return the content item JSON on success.
| Method and route | Endpoint name | Purpose |
|---|---|---|
GET /api/content/{contentItemId} | ApiGetContentItem | Get the published version. 404 if it does not exist. |
POST /api/content | ApiCreateContentItem | Create a new item, or update the item whose ContentItemId matches. Add ?draft=true to save a draft instead of publishing. |
DELETE /api/content/{contentItemId} | ApiDeleteContentItem | Remove the item and return it. 404 if it does not exist. |
{
"ContentItemId": "optional-existing-id",
"ContentType": "BlogPost",
"DisplayText": "My New Post",
"TitlePart": {
"Title": "My New Post"
},
"HtmlBodyPart": {
"Html": "<p>Post content here.</p>"
}
}
ContentType; otherwise the response is 400.400 with an RFC 9457 validation Problem Details body (errors keyed by member name), and nothing is saved.Every endpoint requires AccessContentApi. It also checks content permissions against the item:
| Endpoint | Additional permissions |
|---|---|
GET /api/content/{contentItemId} | ViewContent on the item |
POST /api/content for a new item | EditContent and PublishContent on the new item, then EditContent again on the merged item |
POST /api/content for an existing item | EditContent on the item before and after the merge |
DELETE /api/content/{contentItemId} | DeleteContent on the item |
Missing authentication returns 401 and missing permissions 403; in 4.0 both carry an application/problem+json body.
ManageLiquidTemplatesIn Orchard Core 4.0, a mutation of an item that contains a LiquidPart, a LiquidField, or a FacebookPluginPart, directly or recursively embedded (for example in a BagPart or FlowPart), also requires the security-critical ManageLiquidTemplates permission (OrchardCore.Liquid.Permissions.ManageLiquidTemplates, granted to Administrator and Editor by default). The check runs on the merged item, so an API user without it gets 403 and the whole mutation is cancelled; the Liquid component is not silently dropped. HtmlBodyPart, HtmlField, MarkdownBodyPart, and MarkdownField no longer execute Liquid, so posting Liquid syntax there stores it as plain source.
The endpoints only accept bearer tokens validated by OrchardCore.OpenId.Validation.
OrchardCore.OpenId.Server and OrchardCore.OpenId.Validation, configure a flow (client credentials for services, authorization code + PKCE for apps), and set OpenIdValidationSettings.Tenant to the server tenant. See orchardcore-openid.RoleEntries, and grant its role AccessContentApi plus the content permissions above.roles scope for user-based tokens so the role permissions apply.{
"steps": [
{
"name": "feature",
"enable": [
"OrchardCore.Contents",
"OrchardCore.OpenId.Server",
"OrchardCore.OpenId.Validation"
]
}
]
}
curl -X POST "https://cms.example.com/api/content?draft=true" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "ContentType": "BlogPost", "DisplayText": "Draft post", "TitlePart": { "Title": "Draft post" } }'
To explore and try the endpoints in a browser, enable OrchardCore.OpenApi with the Swagger UI and run the OpenApiPkce recipe (see orchardcore-openapi). With OrchardCore.RateLimits, an Endpoint policy on /api throttles these calls.
Enable OrchardCore.Apis.GraphQL for GraphQL content queries. Callers need ExecuteGraphQL (OrchardCore.Apis.GraphQL.GraphQLPermissions), and results are filtered by ViewContent / ViewOwnContent per content type and per item. See orchardcore-graphql for configuration and custom types.
query {
blogPost {
contentItemId
displayText
publishedUtc
}
}
query {
blogPost(where: {
contentItemId: "417qsjrgv97e74wvp149h4da53"
}) {
contentItemId
displayText
publishedUtc
}
}
| Field | Description |
|---|---|
contentItemId | Unique content item identifier |
contentItemVersionId | Version-specific identifier |
contentType | The content type name |
displayText | Display text of the content item |
published | Whether the item is published |
latest | Whether this is the latest version |
modifiedUtc | Last modification timestamp |
publishedUtc | Publication timestamp |
createdUtc | Creation timestamp |
owner | Owner of the content item |
author | Author of the content item |
{
blogPost {
displayText
autoroutePart {
path
}
}
}
query {
blogPost(orderBy: { publishedUtc: DESC, displayText: ASC }) {
contentItemId
displayText
publishedUtc
}
}
Query drafts, latest versions, or all versions:
query {
blogPost(status: DRAFT) {
contentItemId
displayText
}
}
Status options: PUBLISHED (default), DRAFT, LATEST, ALL.
query {
blogPost(where: {
displayText_in: ["My biggest Adventure", "My latest Hobbies"]
}) {
contentItemId
displayText
}
}
query {
blogPost(where: {
autoroutePart: {
path_contains: "/about"
}
}) {
contentItemId
displayText
}
}
query {
blogPost(where: {
OR: {
AND: {
displayText_in: ["Adventure", "Hobbies"],
publishedUtc_gt: "2024"
},
contentItemId: "417qsjrgv97e74wvp149h4da53"
}
}) {
contentItemId
displayText
}
}
query {
blogPost(first: 10, skip: 20) {
contentItemId
displayText
}
}
{% assign myContent = Content["alias:main-menu"] %}
{% assign myContent = Content["slug:my-blog/my-blog-post"] %}
{% assign myContent = Content.Latest["alias:main-menu"] %}
{% assign myContent = Content.ContentItemId["417qsjrgv97e74wvp149h4da53"] %}
{% assign posts = postIds | content_item_id %}
{% assign myContent = Content.ContentItemVersionId["49gq8g6zndfc736x0az3zsp4w3"] %}
{% contentitem handle:"alias:featured-post", display_type:"Summary" %}
The default display type is Detail. An optional alternate argument is supported.
{{ Model.ContentItem | console_log }}
{{ Model.Content | console_log }}
The Orchard helper (via IOrchardHelper) provides content loading methods:
| Method | Parameters | Description |
|---|---|---|
GetContentItemIdByHandleAsync | string handle | Returns content item ID from a handle |
GetContentItemByHandleAsync | string handle, bool latest = false | Loads content item by handle |
GetContentItemByIdAsync | string contentItemId, bool latest = false | Loads content item by ID |
GetContentItemsByIdAsync | IEnumerable<string> contentItemIds, bool latest = false | Loads multiple content items by IDs |
GetContentItemByVersionIdAsync | string contentItemVersionId | Loads content item by version ID |
ConsoleLog | object content | Logs content to browser console for debugging |
@{
var featuredPost = await Orchard.GetContentItemByHandleAsync("alias:featured-post");
var latestDraft = await Orchard.GetContentItemByIdAsync("some-id", latest: true);
var posts = await Orchard.GetContentItemsByIdAsync(new[] { "id1", "id2", "id3" });
}
@if (featuredPost != null)
{
<h2>@featuredPost.DisplayText</h2>
<p>Published: @featuredPost.PublishedUtc</p>
}
@Orchard.ConsoleLog(Model.Content as object)
@Orchard.ConsoleLog(Model.ContentItem as object)
List content items sharing a stereotype by navigating to:
/Admin/Contents/ContentItems?stereotype=Test
In 4.0, stereotype and contentTypeId accept several values, repeated or comma-separated, for example ?stereotype=Widget,Page or ?contentTypeId=Article&contentTypeId=BlogPost.
Implement IContentsAdminListFilterProvider for custom search behavior:
namespace MyModule;
public sealed class ProductContentsAdminListFilterProvider : IContentsAdminListFilterProvider
{
public void Build(QueryEngineBuilder<ContentItem> builder)
{
builder
.WithNamedTerm("producttext", builder => builder
.ManyCondition(
(val, query) => query.Any(
(q) => q.With<ContentItemIndex>(i =>
i.DisplayText != null && i.DisplayText.Contains(val)),
(q) => q.With<ProductIndex>(i =>
i.SerialNumber != null && i.SerialNumber.Contains(val))
),
(val, query) => query.All(
(q) => q.With<ContentItemIndex>(i =>
i.DisplayText == null || i.DisplayText.NotContains(val)),
(q) => q.With<ProductIndex>(i =>
i.SerialNumber == null || i.SerialNumber.NotContains(val))
)
)
);
}
}
Register the custom filter in Startup:
services.Configure<ContentsAdminListFilterOptions>(options =>
{
options.DefaultTermNames.Add("Product", "producttext");
});
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
/orchardcore:orchardcore-contents-apifrom 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