Provides guidance on using Liquid templates in Orchard Core, covering syntax, global objects, shape rendering, content access, LiquidPart/LiquidField, custom filters/tags, and Fluid 3 upgrades.
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.
Liquid templates use the .liquid extension and receive Orchard Core globals,
shapes, filters, and tags. Liquid is powered by Fluid and all output is HTML
encoded unless the raw filter is used.
{{ Site.SiteName }}
{{ Culture.Name }}
{{ User.Identity.Name }}
{{ Request.Path }}
Use Culture.Name for the current request culture; do not treat
Site.Culture as the current UI culture.
Liquid runs only in shape templates (theme or admin Templates), shortcode
templates, LiquidPart, LiquidField, the Facebook plugin part, Liquid
settings such as patterns, and explicit APIs (ILiquidTemplateManager, the
liquid filter, Orchard.LiquidToHtmlAsync()). HtmlBodyPart, HtmlField,
MarkdownBodyPart, and MarkdownField treat Liquid syntax as plain source
text; they have no RenderLiquid setting anymore.
Both store the authored source in a Liquid property exactly as submitted,
validate it on save, and render it when the shape, body aspect, or GraphQL
liquid field is requested. They have no Sanitize HTML setting because
Liquid can produce HTML, JSON, XML, or plain text. LiquidField has no
field-specific settings and only the standard editor (a CodeMirror Liquid
editor). Both are registered by the OrchardCore.Liquid feature when
OrchardCore.Contents is enabled.
await _contentDefinitionManager.AlterPartDefinitionAsync("LandingPage", part => part
.WithField("Intro", field => field
.OfType("LiquidField")
.WithDisplayName("Intro")
.WithPosition("1")));
await _contentDefinitionManager.AlterTypeDefinitionAsync("Snippet", type => type
.WithPart("TitlePart", part => part.WithPosition("0"))
.WithPart("LiquidPart", part => part.WithPosition("1")));
The LiquidField shape (LiquidField, LiquidFieldViewModel) exposes
Liquid (source), Html (rendered output), Field, Part,
PartFieldDefinition, and ContentItem. Inside the source, ContentItem is
the containing content item:
<h2>{{ ContentItem.DisplayText }}</h2>
<p>{{ "now" | local | date: "%Y" }} {{ Site.SiteName }}</p>
Recipe content stores the source under the field or part name:
{
"steps": [
{
"name": "Content",
"data": [
{
"ContentItemId": "[js:uuid()]",
"ContentType": "LandingPage",
"DisplayText": "Home",
"Latest": true,
"Published": true,
"LandingPage": {
"Intro": { "Liquid": "<p>Welcome to {{ Site.SiteName }}</p>" }
}
}
]
}
]
}
OrchardCore.Liquid.Permissions.ManageLiquidTemplates is security critical and
is granted to Administrator and Editor by default (the migration keeps
existing Editor access). It is required, in addition to the normal content or
template permission, to:
LiquidPart, LiquidField, or FacebookPluginPart bodies.FlowPart, BagPart, or custom
JSON). This applies to the admin editors, the Content API, and remote
publishing; an unauthorized mutation is rejected in full.orchardcore-assisted-templates). Template navigation and
content-definition template shortcuts are hidden without it.if (!await _authorizationService.AuthorizeAsync(User, OrchardCore.Liquid.Permissions.ManageLiquidTemplates))
{
return Forbid();
}
{{ Site.SiteSalt }} was removed for security reasons and only returns
[REDACTED]. {{ Site.Properties }} is redacted by
default because site settings can hold secrets. Allow specific property
sections with SettingsLiquidOptions.PermittedSiteProperties:
{
"OrchardCore": {
"Liquid": {
"PermittedSiteProperties": [
"LayerSettings",
"CurrentThemeName"
]
}
}
}
{{ Site.Properties.LayerSettings.Zones | join: ", " }}
The parser options live in the OrchardCore:Liquid section (the old
OrchardCore_Liquid section is deprecated but still read). All default to
false:
{
"OrchardCore": {
"Liquid": {
"AllowLiquidTag": true,
"AllowParentheses": false,
"AllowTrailingQuestionMark": false
}
}
}
Enable AllowLiquidTag only when the tenant needs the {% liquid %} tag.
slugify lowercases text, strips diacritics, and replaces separators with -;
it keeps non-Latin letters and no longer accepts a transliterate argument.
Chain transliterate (provided by OrchardCore.Localization) when an ASCII
slug is required:
{{ "Crème brûlée" | slugify }} {% comment %} creme-brulee {% endcomment %}
{{ "Ελληνικά" | transliterate | slugify }} {% comment %} ellinika {% endcomment %}
zone is a block tag that adds its child content to a named layout zone. Use
render_section to render a zone:
{% zone "Header" %}
<span class="announcement">Welcome</span>
{% endzone %}
{% render_section "Header", required: false %}
{% render_section "Content", required: true %}
{% shape "Menu", alias: "alias:main-menu" %}
{% contentitem alias: "alias:featured-article", display_type: "Summary" %}
{% contentitem id: "4j42fxryjcpqkkacmg6cwz3pr5" %}
An alias argument receives an Orchard content handle, including the alias:
prefix. Render an already built shape with shape_render:
{{ Model.Content.HtmlBodyPart | shape_render }}
Render the part or field shape rather than its stored source. The stored HTML
or Markdown is the authored, unsanitized source; the shape output has
shortcodes processed and is sanitized when SanitizeHtml is enabled. If you
must output stored HTML directly, sanitize it explicitly:
{{ Model.ContentItem.Content.Article.Summary.Html | sanitize_html | raw }}
{{ Model.ContentItem.DisplayText }}
{{ Model.ContentItem.Content.AutoroutePart.Path }}
{{ "Welcome to Orchard Core" | t }}
{{ "Hello {0}!" | t: User.Identity.Name }}
Use the t filter for localized UI text; it also works in workflow Liquid
expressions. Use normal Fluid control flow and Orchard filters for content:
{% if User | has_permission: "EditContent", Model.ContentItem %}
<a href="{{ Model.ContentItem | edit_url }}">Edit</a>
{% endif %}
{% assign item = featuredContentItemId | content_item_id %}
{{ item.DisplayText }}
The d filter (from OrchardCore.DataLocalization) translates dynamic data,
such as content type or field display names, using a context:
{{ "Blog" | d: "Content Types" }}
{{ "New {0}" | d: "Content Types", "Article" }}
.liquid shape templates are rendered by LiquidShapeTemplateViewEngine,
directly with Fluid, instead of as Razor partials of a LiquidPage. The
LiquidViewExtensionProvider is no longer registered and the Razor shape
engine ignores .liquid files. Liquid files used as controller views still use
LiquidPage. PO localization contexts are unchanged.
Use ILiquidTemplateManager for explicit, trusted templates:
public sealed class SnippetRenderer
{
private readonly ILiquidTemplateManager _liquidTemplateManager;
private readonly HtmlEncoder _htmlEncoder;
public SnippetRenderer(ILiquidTemplateManager liquidTemplateManager, HtmlEncoder htmlEncoder)
{
_liquidTemplateManager = liquidTemplateManager;
_htmlEncoder = htmlEncoder;
}
public async Task<string> RenderAsync(string template, ContentItem contentItem)
{
if (!_liquidTemplateManager.Validate(template, out var errors))
{
throw new InvalidOperationException(string.Join(" ", errors));
}
return await _liquidTemplateManager.RenderStringAsync(
template,
_htmlEncoder,
contentItem,
new Dictionary<string, FluidValue> { ["ContentItem"] = ObjectValue.Create(contentItem) });
}
}
LiquidViewTemplateExtensions.RenderAsync() renders a parsed template in a
Liquid view scope; InvokeInScopeAsync() runs a callback with Model and
ViewLocalizer set from an explicit ViewContext (pass null outside a
request). Only run the liquid filter or Orchard.LiquidToHtmlAsync() on
trusted source; running them on HtmlField or HtmlBodyPart content
re-enables Liquid for editors who do not have ManageLiquidTemplates.
using Fluid;
using Fluid.Values;
namespace MyModule;
public sealed class ReadingTimeFilter : ILiquidFilter
{
public ValueTask<FluidValue> ProcessAsync(
FluidValue input,
FilterArguments arguments,
LiquidTemplateContext context)
{
// Fluid 3: conversions take the template context.
var wordCount = input.ToStringValue(context)
.Split(' ', StringSplitOptions.RemoveEmptyEntries)
.Length;
// Fluid 3: built-in values are created with factories, not constructors.
return ValueTask.FromResult<FluidValue>(StringValue.Create($"{Math.Max(1, wordCount / 200)} min read"));
}
}
services.AddLiquidFilter<ReadingTimeFilter>("reading_time");
AddLiquidFilter<T>() registers the filter as a scoped service, so it can take
dependencies. StringValue.Create(null) returns NilValue.Instance (falsy in a
template); pass text ?? string.Empty when an empty string matters.
Orchard Core 4.0 uses Fluid 3 (built on Parlot 2). A tenant's TemplateOptions
are immutable: they are built once from TemplateOptionsBuilder, which is what
a module configures, and are still read from IOptions<TemplateOptions>.
using Fluid;
using Fluid.Values;
using OrchardCore.Liquid;
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.Configure<TemplateOptionsBuilder>(options =>
{
// A filter without dependencies (use ILiquidFilter and AddLiquidFilter<T>() when it needs services).
options.AddFilter("shout", (input, arguments, context) =>
StringValue.Create(input.ToStringValue(context).ToUpperInvariant()));
// A value available in every template.
options.WithGlobalValue("Store", ObjectValue.Create(new StoreAccessor()));
// Converts a CLR object to a Liquid value.
options.AddValueConverter(x => x is Money money ? NumberValue.Create(money.Amount) : null);
// A member computed on demand.
options.ConfigureMemberAccess(strategy =>
strategy.Register<StoreAccessor, Product>("Featured", (obj, context) => GetFeaturedProduct(context)));
});
}
}
IConfigureOptions<TemplateOptionsBuilder>.services.Configure<TemplateOptions>() or IConfigureOptions<TemplateOptions>
is never applied and throws an InvalidOperationException the first time the
options are resolved.User and Site are restricted,
register an accessor for all its members:options.ConfigureMemberAccess(strategy => strategy.Register<Account, FluidValue>((account, name, context) => name switch
{
nameof(Account.DisplayName) => StringValue.Create(account.DisplayName),
_ => NilValue.Instance,
}));
LiquidViewOptions.FileProviders:
services.Configure<LiquidViewOptions>(o => o.FileProviders.Add(provider)).FluidParserOptions is immutable and only set from the OrchardCore:Liquid
section; it can no longer be changed with services.Configure<FluidParserOptions>().Register tags on the LiquidViewParser with
LiquidViewOptions.LiquidViewParserConfiguration. Tags, blocks and Statements
write to an IFluidOutput instead of a TextWriter:
services.Configure<LiquidViewOptions>(options => options.LiquidViewParserConfiguration.Add(parser =>
{
parser.RegisterParserTag("product_link", parser.ArgumentsListParser, ProductLinkTag.WriteToAsync);
}));
public static class ProductLinkTag
{
public static async ValueTask<Completion> WriteToAsync(
IReadOnlyList<FilterArgument> arguments,
IFluidOutput output,
TextEncoder encoder,
TemplateContext context)
{
var name = (await arguments[0].Expression.EvaluateAsync(context)).ToStringValue(context);
output.Write(encoder.Encode(name));
output.Write(new HtmlString("<hr />"), (HtmlEncoder)encoder); // OrchardCore.Liquid extension.
// For components that render to a TextWriter, such as IResourceManager.RenderLocalScript().
var writer = output.AsTextWriter(); // OrchardCore.Liquid extension.
return Completion.Normal;
}
}
Write(IHtmlContent, HtmlEncoder) and AsTextWriter() are extension methods of
OrchardCore.Liquid.FluidOutputHtmlExtensions. ViewBufferTextWriterContent is
also an IFluidOutput, so a block can render its statements into it, and its
ToString() returns the content. A custom FluidValue must override
WriteToAsync(IFluidOutput, TextEncoder, TemplateContext) or it renders nothing.
RenderLiquid on HtmlBodyPart, HtmlField, MarkdownBodyPart, and
MarkdownField is gone; Liquid in that source now renders as literal text.
Tenant startup logs a warning per affected type, part, and field. Move the
source to LiquidPart or a LiquidField manually.ManageLiquidTemplates to custom roles that edit Liquid parts or
fields, content containing them, or templates.{{ Site.SiteSalt }} (now [REDACTED]) and list any Site.Properties
sections you read in OrchardCore:Liquid:PermittedSiteProperties.slugify: transliterate: true is no longer supported; use
transliterate | slugify.OrchardCore_Liquid configuration section to OrchardCore:Liquid.| 3.x (Fluid 2) | 4.0 (Fluid 3) |
|---|---|
services.Configure<TemplateOptions>(o => ...) | services.Configure<TemplateOptionsBuilder>(o => ...) |
IConfigureOptions<TemplateOptions> | IConfigureOptions<TemplateOptionsBuilder> |
o.MemberAccessStrategy.Register<T>() | Remove it; every public member is readable |
o.MemberAccessStrategy.Register<T, TValue>(...) | o.ConfigureMemberAccess(strategy => strategy.Register<T, TValue>(...)) |
o.Filters.AddFilter("name", filter) | o.AddFilter("name", filter) |
o.ValueConverters.Add(converter) | o.AddValueConverter(converter) |
o.Scope.SetValue("name", value) | o.WithGlobalValue("name", value) |
o.FileProvider = provider | services.Configure<LiquidViewOptions>(o => o.FileProviders.Add(provider)) |
new TemplateOptions() | new TemplateOptionsBuilder().Build() or TemplateOptions.Default |
Tag WriteToAsync(..., TextWriter writer, ...) | WriteToAsync(..., IFluidOutput output, ...), writing with output.Write(...) and output.AsTextWriter() |
value.ToStringValue(), ToNumberValue(), ToBooleanValue(), ToObjectValue() | The same methods with the TemplateContext, for example value.ToStringValue(context) |
value.Enumerate(context) | await foreach (var item in value.EnumerateAsync(context)) |
value.Contains(item) | await value.ContainsAsync(item, context) |
new StringValue(text) / new StringValue(text, false) | StringValue.Create(text) / StringValue.Create(text, encode: false) |
new ObjectValue(x), new ArrayValue(x), new FunctionValue(...) | ObjectValue.Create(x), ArrayValue.Create(x), FunctionValue.Create(...) |
context.EnterChildScope() then context.ReleaseScope() | using var scope = context.EnterScope(); |
LiquidTagHelperActivator.Create(...), LiquidTagHelperFactory.CreateTagHelper(...) | Pass the TemplateContext too |
Parlot 1 ZeroOrOne(parser) returning a single value | Parlot 2 ZeroOrOne returns a list; use parser.Else(fallback) |
Parser<T>.Compile() | Remove the call |
See references/liquid-examples.md for layout, content, and zone examples.
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-liquidfrom orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin orchardcoreOther plugins' skills for the same job