webiny-page-settings-extensions
它能做什么
这项技能在你的 AI 为 Webiny Website Builder 的页面设置添加设置标签页或字段时提供指导。适合自定义 Webiny 网站的开发者。
适用场景
- ✓当你希望在页面设置抽屉中添加新标签页,例如发布或分析的时候。
- ✓当你需要在现有页面设置分组(如 SEO)中添加字段的时候。
- ✓当你需要存储自定义页面设置,而不改动内置属性的时候。
技能链接
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/website-builder/page-settings/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在 Website Builder 页面设置中添加一个分析标签页,让编辑者可以输入跟踪 ID。”
每周 5 个新技能,1 分钟读完。
工作原理
技能演示如何为新标签页创建设置分组类,或为现有分组创建修改器,将其注册为功能,并把数据存放在页面的 extensions 区域下。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Page Settings Extensions
TL;DR
Page settings extensions let you add new tabs to the page settings drawer or inject fields into existing tabs. Create a class implementing PageSettingsGroup.Interface for a new tab, or PageSettingsGroupModifier.Interface to extend an existing one. Register both via createFeature() and <RegisterFeature>. Always store custom data in doc.extensions — never write to doc.properties, which is reserved for built-in system properties.
YOU MUST include the full file path with the .tsx extension in every src prop. For example, use src={"/extensions/myPageSettings/index.tsx"}, NOT src={"/extensions/myPageSettings/index"}. Omitting the file extension will cause a build failure.
For field types, renderers, layout, validation, and all other form builder APIs, refer to the webiny-form-model skill.
Important: Where to Store Data
Use
doc.extensionsfor all custom data. Thedoc.propertiesobject holds built-in system properties (title, path, snippet, image, tags, seo, social). Writing custom fields intodoc.propertiesrisks naming collisions with future Webiny updates and can corrupt system behavior. Always namespace your data underdoc.extensions.<yourGroupName>.
// CORRECT — custom data in doc.extensions
mapFromForm(formData, doc) {
doc.extensions.mySettings = doc.extensions.mySettings ?? {};
doc.extensions.mySettings.myField = formData.myField;
}
// WRONG — never write custom data into doc.properties
mapFromForm(formData, doc) {
doc.properties.myField = formData.myField; // DON'T DO THIS
}
Adding a New Settings Group
A new settings group appears as its own tab in the page settings drawer. Implement PageSettingsGroup.Interface with these members:
| Member | Type | Description |
|---|---|---|
name |
string |
Unique group identifier (used as form field namespace) |
label |
string |
Tab label shown in the UI |
description |
string (optional) |
Description shown below the tab label |
icon |
{ type: "icon", name: string } (optional) |
FontAwesome icon for the tab (e.g., "fas/calendar-alt") |
buildForm(form) |
method | Define fields and layout |
mapToForm(doc) |
method | Read from document to populate the form |
mapFromForm(formData, doc) |
method | Write form values back to the document |
Complete Example: Publishing Settings Group
// extensions/myPageSettings/PublishingSettingsGroup.ts
import { PageSettingsGroup } from "webiny/admin/website-builder/page/editor";
class PublishingSettingsGroupImpl implements PageSettingsGroup.Interface {
name = "publishing";
label = "Publishing";
description = "Configure publishing schedule and visibility.";
icon = { type: "icon", name: "fas/calendar-alt" };
buildForm(form: PageSettingsGroup.FormBuilder): void {
form.fields(fields => ({
publishDate: fields.datetime().withTimezone().label("Publish date"),
unpublishDate: fields.datetime().dateOnly().label("Unpublish date"),
visibility: fields
.text()
.label("Visibility")
.options([
{ label: "Public", value: "public" },
{ label: "Private", value: "private" },
{ label: "Password Protected", value: "password" }
])
.defaultValue("public"),
featured: fields.boolean().label("Featured page")
}));
form.layout(layout => [
layout.row("publishDate"),
layout.row("unpublishDate"),
layout.row("visibility"),
layout.row("featured")
]);
}
mapToForm(doc: PageSettingsGroup.PageDocument): Record<string, any> {
const publishing = doc.extensions?.publishing;
return {
publishDate: publishing?.publishDate ?? null,
unpublishDate: publishing?.unpublishDate ?? null,
visib
常见问题
自定义页面数据应存放在哪里?
存放在页面的 extensions 区域下,使用你选择的名称,绝不放在内置属性中。
它会解释每一种表单字段类型吗?
不会。它会参考表单模型技能,了解字段类型、渲染器和校验。
源路径必须包含什么?
必须包含带 .tsx 扩展名的完整文件路径,否则构建会失败。
详情
作者的原始描述
Extending the Website Builder page settings with custom settings groups and modifiers. Use this skill when the developer wants to add a new tab/group to the page settings drawer (e.g., Publishing, Analytics, Access Control), or modify an existing settings group (e.g., add fields to General or SEO). Covers PageSettingsGroup, PageSettingsGroupModifier, and the doc.extensions data model. For field types, renderers, and layout details, see the webiny-form-model skill.
repo: webiny/webiny-js
热度
- GitHub 星标
- 8.1k
- 排名
- #12579
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
prd-to-plan
8.1k帮你的智能体把产品需求文档转化为分阶段的计划,由许多小的端到端切片组成,并保存为 Markdown 文件。
webiny-admin-architect
8.1k教你的智能体如何为 Webiny 平台构建管理界面,使用其业务逻辑层和呈现器模式。
webiny-admin-permissions
8.1k教你的智能体为 Webiny 管理界面添加权限控制,包括自动生成的权限表单以及显示或隐藏检查。
webiny-form-model
8.1k教你的智能体使用声明式字段构建器、布局、校验和条件规则,在 Webiny 中构建表单。