umbraco-dynamic-root by umbraco/umbraco-cms-backoffice-skills
npx skills add https://github.com/umbraco/umbraco-cms-backoffice-skills --skill umbraco-dynamic-root动态根节点允许内容选择器的起始点(原点)由动态方式确定,而不是固定的节点。这包括两种扩展类型:
这些功能使得内容选择器配置能够根据上下文灵活调整。
在实施前,请务必获取最新的文档:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
import type { ManifestDynamicRootOrigin } from '@umbraco-cms/backoffice/extension-registry';
const manifest: ManifestDynamicRootOrigin = {
type: 'dynamicRootOrigin',
alias: 'My.DynamicRootOrigin.SiteRoot',
name: 'Site Root Origin',
meta: {
originAlias: 'SiteRoot',
label: 'Site Root',
description: 'Start from the root of the current site',
icon: 'icon-home',
},
};
export const manifests = [manifest];
import type { ManifestDynamicRootQueryStep } from '@umbraco-cms/backoffice/extension-registry';
const manifest: ManifestDynamicRootQueryStep = {
type: 'dynamicRootQueryStep',
alias: 'My.DynamicRootQueryStep.NearestBlog',
name: 'Nearest Blog Query Step',
meta: {
queryStepAlias: 'NearestBlog',
label: 'Nearest Blog',
description: 'Find the nearest blog ancestor',
icon: 'icon-article',
},
};
export const manifests = [manifest];
import type { ManifestDynamicRootOrigin, ManifestDynamicRootQueryStep } from '@umbraco-cms/backoffice/extension-registry';
const originManifests: ManifestDynamicRootOrigin[] = [
{
type: 'dynamicRootOrigin',
alias: 'My.DynamicRootOrigin.CurrentPage',
name: 'Current Page Origin',
meta: {
originAlias: 'CurrentPage',
label: 'Current Page',
description: 'Start from the page being edited',
icon: 'icon-document',
},
},
{
type: 'dynamicRootOrigin',
alias: 'My.DynamicRootOrigin.Parent',
name: 'Parent Page Origin',
meta: {
originAlias: 'Parent',
label: 'Parent Page',
description: 'Start from the parent of current page',
icon: 'icon-arrow-up',
},
},
];
const queryStepManifests: ManifestDynamicRootQueryStep[] = [
{
type: 'dynamicRootQueryStep',
alias: 'My.DynamicRootQueryStep.Children',
name: 'Children Query Step',
meta: {
queryStepAlias: 'Children',
label: 'Children',
description: 'Get all child pages',
icon: 'icon-tree',
},
},
{
type: 'dynamicRootQueryStep',
alias: 'My.DynamicRootQueryStep.Ancestors',
name: 'Ancestors Query Step',
meta: {
queryStepAlias: 'Ancestors',
label: 'Ancestors',
description: 'Get ancestor pages',
icon: 'icon-navigation-up',
},
},
];
export const manifests = [...originManifests, ...queryStepManifests];
动态根节点需要后端 C# 实现来处理实际的查询逻辑:
// 自定义原点的 C# 实现示例
public class SiteRootDynamicRootOrigin : IDynamicRootOrigin
{
public string OriginAlias => "SiteRoot";
public Task<Guid?> GetOriginAsync(Guid contentKey, string? entityType)
{
// 根据内容的位置返回站点根节点的 GUID
// 具体实现取决于您的站点结构
return Task.FromResult<Guid?>(GetSiteRootForContent(contentKey));
}
}
// 自定义查询步骤的 C# 实现示例
public class NearestBlogQueryStep : IDynamicRootQueryStep
{
public string QueryStepAlias => "NearestBlog";
public Task<IEnumerable<Guid>> ExecuteAsync(Guid originKey, string? entityType)
{
// 从原点查找最近的博客祖先
// 返回匹配的内容 GUID
return Task.FromResult(FindNearestBlogAncestors(originKey));
}
}
// 在 Composer 中注册
public class DynamicRootComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.DynamicRootSteps()
.AddOrigin<SiteRootDynamicRootOrigin>()
.AddQueryStep<NearestBlogQueryStep>();
}
}
| 属性 | 描述 |
|---|---|
originAlias | 与后端实现匹配的唯一标识符 |
label | 在选择器配置中显示的名称 |
description | 解释原点的帮助文本 |
icon | 在配置界面中显示的图标 |
| 属性 | 描述 |
|---|---|
queryStepAlias | 与后端实现匹配的唯一标识符 |
label | 在选择器配置中显示的名称 |
description | 解释查询步骤的帮助文本 |
icon | 在配置界面中显示的图标 |
就是这样!请务必获取最新的文档,保持示例简洁,生成完整可用的代码。
每周安装数
75
代码仓库
GitHub 星标数
17
首次出现
2026年2月4日
安全审计
安装于
github-copilot55
cursor25
opencode23
codex23
amp21
kimi-cli21
Dynamic Roots allow content pickers to have a starting point (origin) that is determined dynamically rather than being a fixed node. This includes two extension types:
These enable flexible content picker configurations that adapt based on context.
Always fetch the latest docs before implementing:
import type { ManifestDynamicRootOrigin } from '@umbraco-cms/backoffice/extension-registry';
const manifest: ManifestDynamicRootOrigin = {
type: 'dynamicRootOrigin',
alias: 'My.DynamicRootOrigin.SiteRoot',
name: 'Site Root Origin',
meta: {
originAlias: 'SiteRoot',
label: 'Site Root',
description: 'Start from the root of the current site',
icon: 'icon-home',
},
};
export const manifests = [manifest];
import type { ManifestDynamicRootQueryStep } from '@umbraco-cms/backoffice/extension-registry';
const manifest: ManifestDynamicRootQueryStep = {
type: 'dynamicRootQueryStep',
alias: 'My.DynamicRootQueryStep.NearestBlog',
name: 'Nearest Blog Query Step',
meta: {
queryStepAlias: 'NearestBlog',
label: 'Nearest Blog',
description: 'Find the nearest blog ancestor',
icon: 'icon-article',
},
};
export const manifests = [manifest];
import type { ManifestDynamicRootOrigin, ManifestDynamicRootQueryStep } from '@umbraco-cms/backoffice/extension-registry';
const originManifests: ManifestDynamicRootOrigin[] = [
{
type: 'dynamicRootOrigin',
alias: 'My.DynamicRootOrigin.CurrentPage',
name: 'Current Page Origin',
meta: {
originAlias: 'CurrentPage',
label: 'Current Page',
description: 'Start from the page being edited',
icon: 'icon-document',
},
},
{
type: 'dynamicRootOrigin',
alias: 'My.DynamicRootOrigin.Parent',
name: 'Parent Page Origin',
meta: {
originAlias: 'Parent',
label: 'Parent Page',
description: 'Start from the parent of current page',
icon: 'icon-arrow-up',
},
},
];
const queryStepManifests: ManifestDynamicRootQueryStep[] = [
{
type: 'dynamicRootQueryStep',
alias: 'My.DynamicRootQueryStep.Children',
name: 'Children Query Step',
meta: {
queryStepAlias: 'Children',
label: 'Children',
description: 'Get all child pages',
icon: 'icon-tree',
},
},
{
type: 'dynamicRootQueryStep',
alias: 'My.DynamicRootQueryStep.Ancestors',
name: 'Ancestors Query Step',
meta: {
queryStepAlias: 'Ancestors',
label: 'Ancestors',
description: 'Get ancestor pages',
icon: 'icon-navigation-up',
},
},
];
export const manifests = [...originManifests, ...queryStepManifests];
Dynamic roots require backend C# implementation to handle the actual query logic:
// Example C# implementation for a custom origin
public class SiteRootDynamicRootOrigin : IDynamicRootOrigin
{
public string OriginAlias => "SiteRoot";
public Task<Guid?> GetOriginAsync(Guid contentKey, string? entityType)
{
// Return the site root GUID based on the content's position
// Implementation depends on your site structure
return Task.FromResult<Guid?>(GetSiteRootForContent(contentKey));
}
}
// Example C# implementation for a custom query step
public class NearestBlogQueryStep : IDynamicRootQueryStep
{
public string QueryStepAlias => "NearestBlog";
public Task<IEnumerable<Guid>> ExecuteAsync(Guid originKey, string? entityType)
{
// Find nearest blog ancestor from the origin
// Return matching content GUIDs
return Task.FromResult(FindNearestBlogAncestors(originKey));
}
}
// Register in Composer
public class DynamicRootComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.DynamicRootSteps()
.AddOrigin<SiteRootDynamicRootOrigin>()
.AddQueryStep<NearestBlogQueryStep>();
}
}
| Property | Description |
|---|---|
originAlias | Unique identifier matching backend implementation |
label | Display name in picker configuration |
description | Help text explaining the origin |
icon | Icon shown in configuration UI |
| Property | Description |
|---|---|
queryStepAlias | Unique identifier matching backend implementation |
label | Display name in picker configuration |
description | Help text explaining the query step |
icon | Icon shown in configuration UI |
That's it! Always fetch fresh docs, keep examples minimal, generate complete working code.
Weekly Installs
75
Repository
GitHub Stars
17
First Seen
Feb 4, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykWarn
Installed on
github-copilot55
cursor25
opencode23
codex23
amp21
kimi-cli21
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装
Zod 验证工具集:TypeScript 类型安全数据验证与表单集成方案
166 周安装
Readwise Reader 读者画像构建技能 - 基于阅读历史分析,实现个性化内容推荐与体验优化
168 周安装
OMC Doctor:Claude代码助手安装诊断与修复工具 - 解决OMC插件问题
175 周安装
微信文章转Markdown工具 - 高效抓取公众号文章并转换为Markdown格式,支持存档与AI处理
215 周安装
Mantine Combobox 组件:React 下拉选择与自动完成的底层原语 | 构建自定义 UI
241 周安装
新西兰商务英语指南:专业写作、毛利语使用与语气规范 | 商务沟通技巧
228 周安装