Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)8.1k · #12579

webiny-page-settings-extensions

Skill này làm gì

Skill này hướng dẫn AI của bạn khi thêm tab hoặc trường cài đặt vào cài đặt trang trong Website Builder của Webiny. Dành cho lập trình viên tùy chỉnh một website Webiny.

Khi nào nên dùng

  • ✓Khi bạn muốn một tab mới trong ngăn cài đặt trang, như Xuất bản hoặc Phân tích.
  • ✓Khi bạn cần thêm trường vào một nhóm cài đặt trang hiện có, như SEO.
  • ✓Khi bạn cần lưu cài đặt trang tùy chỉnh mà không đụng đến thuộc tính có sẵn.

Liên kết skill

https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/website-builder/page-settings/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/website-builder/page-settings/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Thêm tab Phân tích vào cài đặt trang của Website Builder, nơi biên tập viên có thể nhập mã theo dõi.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill cho thấy cách tạo một class nhóm cài đặt cho tab mới hoặc một modifier cho tab hiện có, đăng ký nó như một tính năng, và lưu dữ liệu dưới khu vực extensions của trang.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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.extensions for all custom data. The doc.properties object holds built-in system properties (title, path, snippet, image, tags, seo, social). Writing custom fields into doc.properties risks naming collisions with future Webiny updates and can corrupt system behavior. Always namespace your data under doc.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
Câu hỏi thường gặp

Dữ liệu trang tùy chỉnh nên được lưu ở đâu?

Dưới khu vực extensions của trang với tên bạn chọn, không bao giờ trong các thuộc tính có sẵn.

Nó có giải thích mọi loại trường form không?

Không. Nó tham chiếu skill model form cho các loại trường, trình render và kiểm tra hợp lệ.

Đường dẫn nguồn phải có gì?

Đường dẫn file đầy đủ với đuôi .tsx, nếu không bản build sẽ lỗi.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
8.1k
Vị trí xếp hạng
#12579
Giấy phép
—
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự