Accesses and extends Orchard Core site settings: reading via ISiteService, creating settings groups with SiteDisplayDriver, managing permissions, and building refreshable options without shell release.
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 code and configuration for reading site settings, adding code-defined settings groups to the admin, and feeding options from site settings.
OrchardCore.Settings is always enabled. Site settings are a single per-tenant document (ISite); modules add their own sections to its Properties bag.ISiteService.GetSiteSettingsAsync() (cached, read-only) to read; use LoadSiteSettingsAsync() before modifying and saving with UpdateSiteSettingsAsync().site.TryGet<TSettings>(out var settings) or site.GetOrCreate<TSettings>(); site.As<T>() is obsolete. ISiteService.GetSettingsAsync<T>() is a shortcut.ContentPart) edited by a SiteDisplayDriver<TSettings> with a unique SettingsGroupId.AddSiteSettingsPermission(groupId, permission) and check that permission in both EditAsync and UpdateAsync of the driver..Location(l => l.Zone("Content", "5").Card(S["Social links"], "10")). Return one shape per card with Combine(...) for a longer form; views render rows only, never card markup (see orchardcore-admin-edit-views).IOptionsMonitor<TOptions> refresh pipeline over a shell release: register AddSignalOptionsChangeTokenSource<TOptions>(), call IOptionsUpdateNotifier.RequestUpdate<TOptions>() from the driver, and read IOptionsMonitor<TOptions>.CurrentValue.IShellReleaseManager.RequestRelease() plus context.AddTenantReloadWarningWrapper() only when the change affects service registration, middleware, or other state that is built once per shell. Do not gate RequestRelease() on ModelState.IsValid; the settings controller only releases after a successful save.CustomSettings stereotype; see orchardcore-custom-settings.Site.Properties are hidden from Liquid unless listed in OrchardCore:Liquid:PermittedSiteProperties.LocalizationSource values; create them with LocalizationSource.Create(value, typeof(DeclaringType)).sealed modifier, except view models.{ "steps": [...] } format.| Service | Purpose |
|---|---|
ISiteService | Read (GetSiteSettingsAsync) and write (LoadSiteSettingsAsync, UpdateSiteSettingsAsync) the site settings document. |
ISite | Site settings object. TryGet<T>(out ...) / GetOrCreate<T>() read sections from Properties. |
SiteDisplayDriver<TSettings> | Renders and updates one settings section in a settings group. |
AddSiteSettingsPermission(groupId, permission) | Lets the shared settings controller authorize a group with its own permission. |
IOptionsUpdateNotifier | Requests an IOptionsMonitor<TOptions> refresh after the settings commit. |
IShellReleaseManager | Requests a tenant reload after a shell-affecting settings change. |
INavigationProvider / AdminNavigationProvider | Adds the settings page to the admin menu. |
| Property | Type | Description |
|---|---|---|
SiteName | string | Display name of the site. |
PageTitleFormat | string | Liquid format of the page <title>. |
BaseUrl | string | Absolute http/https base URL used when an absolute URL must be generated; no query string or fragment. Stored as a Uri, so it reads back normalized (https://example.com becomes https://example.com/) and setting a non-absolute value throws UriFormatException. |
TimeZoneId | string | Default time zone identifier (e.g. America/New_York). |
Calendar | string | Default calendar system. |
PageSize | int | Default number of items per page. |
MaxPageSize | int | Maximum page size a client can request. |
MaxPagedCount | int | Maximum number of items that can be paged through; lists report it as the total instead of counting (unless the current page isn't full). When 0, OrchardCore:Navigation:PagerOptions:MaxPagedCount from configuration is used. |
AllowPageSizeSelection | bool | Shows an Items per page selector next to pagers (4.0). |
PageSizeOptions | int[] | Allowed page sizes, default 10, 25, 50, 100 (4.0). |
UseCdn / CdnBaseUrl | bool / string | Serve framework assets from a CDN. CdnBaseUrl must be an absolute URL (any scheme) without query string or fragment, and is normalized the same way. |
ResourceDebugMode | ResourceDebugMode | Serve non-minified resources. |
AppendVersion | bool | Append a version token to static asset URLs. |
CacheMode | CacheMode | Default resource caching behavior. |
HomeRoute | RouteValueDictionary | Route of the home page. |
SuperUser, SiteSalt | string | Internal; never expose them. |
There is no Culture property on ISite; cultures are managed by the Localization module.
public sealed class MyService
{
private readonly ISiteService _siteService;
public MyService(ISiteService siteService)
{
_siteService = siteService;
}
public async Task<string> GetSiteNameAsync()
{
var site = await _siteService.GetSiteSettingsAsync();
return site.SiteName;
}
public async Task<SocialMediaSettings> GetSocialMediaSettingsAsync()
=> await _siteService.GetSettingsAsync<SocialMediaSettings>();
}
ISiteService.GetSiteSettings() and GetSettings<T>() are synchronous variants for code paths that cannot be async, such as IConfigureOptions<T>.Configure(); site settings are preloaded when the tenant activates.
public async Task UpdateBaseUrlAsync(string newBaseUrl)
{
var site = await _siteService.LoadSiteSettingsAsync();
site.BaseUrl = newBaseUrl;
await _siteService.UpdateSiteSettingsAsync(site);
}
The General group (/Admin/Settings/general) requires ManageGeneralSettings; the Debugging group requires ManageDebuggingSettings. ManageSettings implies both.
Since 4.0 the general settings render one shape per card: Settings_Edit__Site (Site tab, General card), Settings_Edit__TimeZone (Regional settings card), Settings_Edit__Pagination (Pagination card), Settings_Edit__Resources (Resources tab, Scripts and stylesheets card) and Settings_Edit__Cache (Cache tab, Dynamic cache card), with the templates Settings-Site.Edit.cshtml, Settings-TimeZone.Edit.cshtml, Settings-Pagination.Edit.cshtml, Settings-Resources.Edit.cshtml and Settings-Cache.Edit.cshtml. Overrides of the former single template must be split accordingly.
With Page size selection enabled, the shared Pager and PagerSlim shapes render an Items per page selector (Pager_PageSizeSelector shape, receives PageSizes and CurrentPageSize) on admin and front-end lists. The value travels as the pageSize query string and is honored only when it is one of PageSizeOptions. Custom listings opt into the same validation through PagerOptions:
public sealed class ProductsController : Controller
{
private readonly PagerOptions _pagerOptions;
public ProductsController(IOptions<PagerOptions> pagerOptions)
{
_pagerOptions = pagerOptions.Value;
}
public IActionResult Index(PagerParameters pagerParameters)
{
// Applies AllowPageSizeSelection and PageSizeOptions, otherwise falls back to the site page size.
var pager = new Pager(pagerParameters, _pagerOptions);
// ... query with pager.GetStartIndex() and pager.PageSize
return View();
}
}
PagerOptions.GetPageSize(int? selectedPageSize, int defaultPageSize) validates a requested size against a list's own default, and PagerSlimParameters carries an optional PageSize.
public sealed class SocialMediaSettings
{
public string FacebookUrl { get; set; }
public bool ShowSocialLinks { get; set; }
}
public static class SocialMediaPermissions
{
public static readonly Permission ManageSocialMediaSettings = new(
"ManageSocialMediaSettings",
LocalizationSource.Create("Manage social media settings", typeof(SocialMediaPermissions)));
}
public sealed class Permissions : IPermissionProvider
{
private readonly IEnumerable<Permission> _allPermissions =
[
SocialMediaPermissions.ManageSocialMediaSettings,
];
public Task<IEnumerable<Permission>> GetPermissionsAsync()
=> Task.FromResult(_allPermissions);
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
}
public sealed class SocialMediaSettingsDisplayDriver : SiteDisplayDriver<SocialMediaSettings>
{
public const string GroupId = "social-media";
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IAuthorizationService _authorizationService;
internal readonly IStringLocalizer S;
public SocialMediaSettingsDisplayDriver(
IHttpContextAccessor httpContextAccessor,
IAuthorizationService authorizationService,
IStringLocalizer<SocialMediaSettingsDisplayDriver> stringLocalizer)
{
_httpContextAccessor = httpContextAccessor;
_authorizationService = authorizationService;
S = stringLocalizer;
}
protected override string SettingsGroupId
=> GroupId;
public override async Task<IDisplayResult> EditAsync(ISite site, SocialMediaSettings settings, BuildEditorContext context)
{
if (!await _authorizationService.AuthorizeAsync(_httpContextAccessor.HttpContext?.User, SocialMediaPermissions.ManageSocialMediaSettings))
{
return null;
}
return Initialize<SocialMediaSettingsViewModel, SocialMediaSettings>("SocialMediaSettings_Edit", static (model, settings) =>
{
model.FacebookUrl = settings.FacebookUrl;
model.ShowSocialLinks = settings.ShowSocialLinks;
}, settings).Location(l => l.Zone("Content", "5").Card(S["Social links"], "10"))
.OnGroup(SettingsGroupId);
}
public override async Task<IDisplayResult> UpdateAsync(ISite site, SocialMediaSettings settings, UpdateEditorContext context)
{
if (!await _authorizationService.AuthorizeAsync(_httpContextAccessor.HttpContext?.User, SocialMediaPermissions.ManageSocialMediaSettings))
{
return null;
}
var model = new SocialMediaSettingsViewModel();
await context.Updater.TryUpdateModelAsync(model, Prefix);
settings.FacebookUrl = model.FacebookUrl?.Trim();
settings.ShowSocialLinks = model.ShowSocialLinks;
return await EditAsync(site, settings, context);
}
}
public class SocialMediaSettingsViewModel
{
public string FacebookUrl { get; set; }
public bool ShowSocialLinks { get; set; }
}
The view model must not be sealed (proxy-based shapes, see analyzer OCSG001 in orchardcore-source-generators).
Views/SocialMediaSettings.Edit.cshtml)The editor renders only its rows, using the admin ocat-* classes; the settings page supplies the form and the Save button (see orchardcore-admin-edit-views).
@model SocialMediaSettingsViewModel
<div class="ocat-wrapper" asp-validation-class-for="FacebookUrl">
<label asp-for="FacebookUrl" class="ocat-label">@T["Facebook URL"]</label>
<div class="ocat-end">
<input asp-for="FacebookUrl" class="form-control" />
<span asp-validation-for="FacebookUrl"></span>
</div>
</div>
<div class="ocat-wrapper">
<div class="ocat-end-offset">
<div class="form-check">
<input asp-for="ShowSocialLinks" class="form-check-input" />
<label asp-for="ShowSocialLinks" class="form-check-label">@T["Display social media links"]</label>
</div>
</div>
</div>
public sealed class AdminMenu : AdminNavigationProvider
{
private static readonly RouteValueDictionary s_routeValues = new()
{
{ "area", "OrchardCore.Settings" },
{ "groupId", SocialMediaSettingsDisplayDriver.GroupId },
};
internal readonly IStringLocalizer S;
public AdminMenu(IStringLocalizer<AdminMenu> stringLocalizer)
{
S = stringLocalizer;
}
protected override ValueTask BuildAsync(NavigationBuilder builder)
{
builder
.Add(S["Settings"], settings => settings
.Add(S["Social Media"], S["Social Media"].PrefixPosition(), entry => entry
.Id("socialMediaSettings")
.Action("Index", "Admin", s_routeValues)
.Permission(SocialMediaPermissions.ManageSocialMediaSettings)
.LocalNav()
)
);
return ValueTask.CompletedTask;
}
}
The groupId route value must match SettingsGroupId; the built-in settings controller serves /Admin/Settings/{groupId}.
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddSiteDisplayDriver<SocialMediaSettingsDisplayDriver>();
services.AddSiteSettingsPermission(SocialMediaSettingsDisplayDriver.GroupId, SocialMediaPermissions.ManageSocialMediaSettings);
services.AddPermissionProvider<Permissions>();
services.AddNavigationProvider<AdminMenu>();
}
}
[RequireFeatures("OrchardCore.Deployment")]
public sealed class DeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddSiteSettingsPropertyDeploymentStep<SocialMediaSettings, DeploymentStartup>(
S => S["Social media settings"],
S => S["Exports the social media settings."]);
}
}
Without AddSiteSettingsPermission, users need the broad ManageSettings permission to open the group.
Use this pattern when services consume settings through options. The options are rebuilt after the settings are committed, on every node when a distributed ISignal (Redis Bus) is enabled.
public sealed class WeatherSettings
{
public string ApiKey { get; set; }
public string Units { get; set; } = "metric";
}
public sealed class WeatherOptions
{
public string ApiKey { get; set; }
public string Units { get; set; }
}
// Builds the options from the site settings each time the monitor cache is invalidated.
public sealed class WeatherOptionsConfiguration : IConfigureOptions<WeatherOptions>
{
private readonly ISiteService _siteService;
public WeatherOptionsConfiguration(ISiteService siteService)
{
_siteService = siteService;
}
public void Configure(WeatherOptions options)
{
var settings = _siteService.GetSettings<WeatherSettings>();
// '??=' keeps values already set from appsettings.json.
options.ApiKey ??= settings.ApiKey;
options.Units ??= settings.Units;
}
}
public sealed class WeatherSettingsDisplayDriver : SiteDisplayDriver<WeatherSettings>
{
public const string GroupId = "weather";
private readonly IOptionsUpdateNotifier _optionsUpdateNotifier;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IAuthorizationService _authorizationService;
internal readonly IStringLocalizer S;
public WeatherSettingsDisplayDriver(
IOptionsUpdateNotifier optionsUpdateNotifier,
IHttpContextAccessor httpContextAccessor,
IAuthorizationService authorizationService,
IStringLocalizer<WeatherSettingsDisplayDriver> stringLocalizer)
{
_optionsUpdateNotifier = optionsUpdateNotifier;
_httpContextAccessor = httpContextAccessor;
_authorizationService = authorizationService;
S = stringLocalizer;
}
protected override string SettingsGroupId
=> GroupId;
public override async Task<IDisplayResult> EditAsync(ISite site, WeatherSettings settings, BuildEditorContext context)
{
if (!await _authorizationService.AuthorizeAsync(_httpContextAccessor.HttpContext?.User, WeatherPermissions.ManageWeatherSettings))
{
return null;
}
return Initialize<WeatherSettingsViewModel, WeatherSettings>("WeatherSettings_Edit", static (model, settings) =>
{
model.ApiKey = settings.ApiKey;
model.Units = settings.Units;
}, settings).Location(l => l.Zone("Content", "5").Card(S["Weather service"], "10"))
.OnGroup(SettingsGroupId);
}
public override async Task<IDisplayResult> UpdateAsync(ISite site, WeatherSettings settings, UpdateEditorContext context)
{
if (!await _authorizationService.AuthorizeAsync(_httpContextAccessor.HttpContext?.User, WeatherPermissions.ManageWeatherSettings))
{
return null;
}
var model = new WeatherSettingsViewModel();
await context.Updater.TryUpdateModelAsync(model, Prefix);
if (!context.Updater.ModelState.IsValid)
{
return await EditAsync(site, settings, context);
}
var apiKey = model.ApiKey?.Trim();
if (settings.ApiKey != apiKey || settings.Units != model.Units)
{
// Dispatched only after the site settings document commits successfully.
_optionsUpdateNotifier.RequestUpdate<WeatherOptions>();
}
settings.ApiKey = apiKey;
settings.Units = model.Units;
return await EditAsync(site, settings, context);
}
}
public sealed class WeatherClient
{
private readonly IOptionsMonitor<WeatherOptions> _options;
public WeatherClient(IOptionsMonitor<WeatherOptions> options)
{
_options = options;
}
// Read CurrentValue at the point of use; never cache it in a field.
public string GetUnits() => _options.CurrentValue.Units;
}
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddSiteDisplayDriver<WeatherSettingsDisplayDriver>();
services.AddSiteSettingsPermission(WeatherSettingsDisplayDriver.GroupId, WeatherPermissions.ManageWeatherSettings);
// Opts WeatherOptions into Orchard Core's signal-backed IOptionsMonitor refresh.
services.AddSignalOptionsChangeTokenSource<WeatherOptions>();
services.AddTransient<IConfigureOptions<WeatherOptions>, WeatherOptionsConfiguration>();
services.AddSingleton<WeatherClient>();
}
}
WeatherPermissions and WeatherSettingsViewModel follow the same shape as the social media example. For named options, register new SignalOptionsChangeTokenSource<TOptions>(signal, name) as IOptionsChangeTokenSource<TOptions> and call RequestUpdate<TOptions>(name). RequestUpdate returns the notifier, so several types can be chained: .RequestUpdate<A>().RequestUpdate<B>().
public override async Task<IDisplayResult> EditAsync(ISite site, MySettings settings, BuildEditorContext context)
{
// ... authorization
context.AddTenantReloadWarningWrapper();
return Initialize<MySettingsViewModel, MySettings>("MySettings_Edit", static (model, settings) =>
{
model.Enabled = settings.Enabled;
}, settings).Location(l => l.Zone("Content", "5").Card(S["General"], "10"))
.OnGroup(SettingsGroupId);
}
public override async Task<IDisplayResult> UpdateAsync(ISite site, MySettings settings, UpdateEditorContext context)
{
// ... authorization and TryUpdateModelAsync
if (settings.Enabled != model.Enabled)
{
_shellReleaseManager.RequestRelease();
}
settings.Enabled = model.Enabled;
return await EditAsync(site, settings, context);
}
{{ Site.SiteName }}, {{ Site.PageSize }}, {{ Site.BaseUrl }} and other ISite properties are available. The site salt was removed from Liquid output ({{ Site.SiteSalt }} only returns [REDACTED]), and {{ Site.Properties }} is empty unless the sections are allowed:
{
"OrchardCore": {
"Liquid": {
"PermittedSiteProperties": [
"SocialMediaSettings",
"CurrentThemeName",
"LayerSettings"
]
}
}
}
{% if Site.Properties.SocialMediaSettings.ShowSocialLinks %}
<a href="{{ Site.Properties.SocialMediaSettings.FacebookUrl }}">Facebook</a>
{% endif %}
Never permit sections holding secrets (API keys, passwords).
@inject OrchardCore.Settings.ISiteService SiteService
@{
var site = await SiteService.GetSiteSettingsAsync();
}
@if (site.TryGet<SocialMediaSettings>(out var social) && social.ShowSocialLinks)
{
<a href="@social.FacebookUrl">Facebook</a>
}
The Settings step sets built-in properties; any other key is stored as a section in Properties:
{
"steps": [
{
"name": "Settings",
"SiteName": "My Orchard Core Site",
"BaseUrl": "https://www.example.com",
"TimeZoneId": "America/New_York",
"PageSize": 10,
"AllowPageSizeSelection": true,
"PageSizeOptions": [ 10, 25, 50, 100 ],
"UseCdn": false,
"SocialMediaSettings": {
"FacebookUrl": "https://facebook.com/contoso",
"ShowSocialLinks": true
}
}
]
}
Use the Site Settings deployment step to export the built-in settings, and AddSiteSettingsPropertyDeploymentStep<TSettings, TLocalizer>() to export one section into the same Settings step.
OrchardCore.Settings.Permissions.ManageSettings / ManageGroupSettings were removed; use OrchardCore.Settings.SettingsPermissions.ManageSettings / ManageGroupSettings. Built-in groups now use ManageGeneralSettings and ManageDebuggingSettings.AddSiteSettingsPermission(groupId, permission) so it no longer requires ManageSettings.IOptions<T> with IOptionsMonitor<T>.CurrentValue, and replace IShellReleaseManager.RequestRelease() with AddSignalOptionsChangeTokenSource<T>() + IOptionsUpdateNotifier.RequestUpdate<T>() when only options depend on the settings.new Permission("Name", "Description") is [Obsolete]; use LocalizationSource.Create("Description", typeof(DeclaringType)) so the roles editor shows PO translations.{{ Site.SiteSalt }} now only returns [REDACTED], and {{ Site.Properties.X }} is empty until X is listed in OrchardCore:Liquid:PermittedSiteProperties.site.As<T>() is obsolete; use TryGet<T>() or GetOrCreate<T>()..Card(S["..."], "10") to the location of each editor shape and remove any card or heading markup from the views. Overrides of the general settings must target the split Settings_Edit__* shapes.BaseUrl and CdnBaseUrl are validated: the editor rejects relative URLs, a BaseUrl that isn't http/https, and any query string or fragment. Both are normalized through Uri.AbsoluteUri, so a host-only value gains a trailing /; build URLs with new Uri(new Uri(site.BaseUrl), path) or trim the slash instead of concatenating site.BaseUrl + "/path". A recipe or code that sets a non-absolute value now throws.See references/site-settings-examples.md for complete examples.
What SKILL.md sets; muted values are Claude Code's defaults
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-site-settingsfrom orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin orchardcoreOther plugins' skills for the same job