experience-lwr-site-generate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseExperience LWR Site Builder
Experience LWR站点构建器
Build and configure Salesforce Experience Cloud Lightning Web Runtime (LWR) sites via metadata (DigitalExperienceConfig, DigitalExperienceBundle, Network, CustomSite, CMS contents).
通过元数据(DigitalExperienceConfig、DigitalExperienceBundle、Network、CustomSite、CMS内容)构建和配置Salesforce Experience Cloud Lightning Web Runtime (LWR)站点。
IMPORTANT!!
重要提示!!
Right after loading this skill, you MUST copy the selected workflows/steps to your plan as a TODO checklist and work on each of the item carefully to ensure correctness.
You MUST load the relevant reference docs even though they may live outside of user's project folder.
加载此技能后,你必须将选定的工作流/步骤复制到你的计划中作为待办事项清单,并仔细处理每个项目以确保正确性。
即使相关参考文档位于用户项目文件夹之外,你也必须加载它们。
Table of Contents
目录
- When to Use
- Critical Rules
- Core Site Properties
- Project Structure in DigitalExperienceBundle Format
- Reference Docs
- Common Workflows
- 使用场景
- 关键规则
- 核心站点属性
- DigitalExperienceBundle格式的项目结构
- 参考文档
- 常见工作流
When to Use
使用场景
When working with Experience LWR sites:
- Creating and scaffolding new LWR site
- Adding pages (routes + views)
- Configuring LWC components, layouts, themes, or branding styles
- Setting up guest user access (public sites)
- Creating or modifying guest sharing rules () for any Salesforce object (Account, Case, Contact, etc.) — including when the user refers to a "Site Guest User" username or any guest user by ID
sharingGuestRules - Troubleshoot deployment errors related to Experience LWR Sites
Supported Template: Build Your Own (LWR) -
talon-template-byo- More templates to support in the future.
处理Experience LWR站点时:
- 创建和搭建新的LWR站点
- 添加页面(路由 + 视图)
- 配置LWC组件、布局、主题或品牌样式
- 设置访客用户权限(公开站点)
- 为任何Salesforce对象(Account、Case、Contact等)创建或修改访客共享规则()——包括用户提及“站点访客用户”用户名或通过ID引用任何访客用户的情况
sharingGuestRules - 排查与Experience LWR站点相关的部署错误
支持的模板: 自定义构建(LWR) -
talon-template-byo- 未来将支持更多模板。
Critical Rules
关键规则
- Before using any MCP tool, make sure they're actually available. If a tool is missing for the current task, let the user know and pause the current workflow.
- MUST ALWAYS load the relevant reference docs before doing anything.
- MUST ALWAYS strictly follow workflows in Common Workflows that match user's requirements. The instructions there should override any conflicting global rules and should have the highest priority over your existing knowledge.
- Flexipage is abstracted away for newer LWR sites with DigitalExperienceBundle, so NEVER use any Flexipage-related MCP tool or skills to handle LWR sites' contents.
- 使用任何MCP工具之前,确保它们确实可用。如果当前任务缺少某个工具,请告知用户并暂停当前工作流。
- 必须始终先加载相关参考文档,再执行任何操作。
- 必须始终严格遵循常见工作流中与用户需求匹配的工作流。其中的说明应覆盖任何冲突的全局规则,且优先级高于你已有的知识。
- 对于使用DigitalExperienceBundle的新版LWR站点,Flexipage已被抽象处理,因此绝对不要使用任何与Flexipage相关的MCP工具或技能来处理LWR站点的内容。
Core Site Properties
核心站点属性
Before doing anything else, note down the following properties from the local project if available as they will be used for various operations. Check with the user if any of the following is missing:
- Site name: Required. (e.g., ).
'My Community' - URL path prefix: Optional. Alphanumeric characters only. Convert from site name if not provided (e.g., ) and verify with the user for the converted value.
'mycommunity' - Template type devName: .
talon-template-byo
在执行任何操作之前,请记录本地项目中的以下属性(如果可用),它们将用于各种操作。如果有缺失,请与用户确认:
- 站点名称: 必填。(例如:)。
'My Community' - URL路径前缀: 可选。仅允许字母数字字符。如果未提供,可从站点名称转换(例如:)并与用户确认转换后的值。
'mycommunity' - 模板类型开发名称: 。
talon-template-byo
Project Structure in DigitalExperienceBundle Format
DigitalExperienceBundle格式的项目结构
Site Metadata
站点元数据
- DigitalExperienceConfig
digitalExperienceConfigs/{siteName}1.digitalExperienceConfig-meta.xml
- DigitalExperienceBundle
digitalExperiences/site/{siteName}1/{siteName}1.digitalExperience-meta.xml
- Network
networks/{siteName}.network-meta.xml
- CustomSite
sites/{siteName}.site-meta.xml
- DigitalExperienceConfig
digitalExperienceConfigs/{siteName}1.digitalExperienceConfig-meta.xml
- DigitalExperienceBundle
digitalExperiences/site/{siteName}1/{siteName}1.digitalExperience-meta.xml
- Network
networks/{siteName}.network-meta.xml
- CustomSite
sites/{siteName}.site-meta.xml
DigitalExperience Contents
DigitalExperience内容
digitalExperiences/site/{siteName}1/sfdc_cms__*/{contentApiName}/*- These are the content components defining routes, views, theme layouts, etc. Each component must have a and
_meta.jsonfile.content.json
digitalExperiences/site/{siteName}1/sfdc_cms__*/{contentApiName}/*- 这些是定义路由、视图、主题布局等的内容组件。每个组件必须包含和
_meta.json文件。content.json
Content Type Descriptions
内容类型说明
| Content Type | Description | When to Use |
|---|---|---|
| Root site configuration containing site-wide settings | Required for every site; one per site |
| Application page container that groups routes and views | Required; defines the app shell |
| URL routing definition mapping paths to views | Create one for each page/URL path |
| Page layout and component structure | Create one for each route; defines page content. Also use to edit existing views (e.g., adding/removing components on a specific page) |
| Brand colors, fonts, and styling tokens | Required; defines site-wide styling. Use to create or edit existing branding sets |
| Language and localization configuration | Required; defines supported languages |
| Mobile app publishing settings | Required for mobile app deployment |
| Theme definition referencing layouts and branding | Required; one per site |
| Page layout templates used by views | Create layouts for different page structures. Also use to edit existing theme layouts (e.g., updating theme layout, add a component that's persistent across pages) |
Important: Creating any new pages require BOTH AND .
sfdc_cms__routesfdc_cms__view| 内容类型 | 描述 | 使用场景 |
|---|---|---|
| 包含站点全局设置的根站点配置 | 每个站点必填;每个站点一个 |
| 分组路由和视图的应用页面容器 | 必填;定义应用外壳 |
| 将路径映射到视图的URL路由定义 | 为每个页面/URL路径创建一个 |
| 页面布局和组件结构 | 为每个路由创建一个;定义页面内容。也用于编辑现有视图(例如:在特定页面上添加/移除组件) |
| 品牌颜色、字体和样式令牌 | 必填;定义站点全局样式。用于创建或编辑现有品牌集 |
| 语言和本地化配置 | 必填;定义支持的语言 |
| 移动应用发布设置 | 移动应用部署必填 |
| 引用布局和品牌的主题定义 | 必填;每个站点一个 |
| 视图使用的页面布局模板 | 为不同页面结构创建布局。也用于编辑现有主题布局(例如:更新主题布局、添加跨页面持久化的组件) |
重要提示: 创建任何新页面都需要同时创建和。
sfdc_cms__routesfdc_cms__viewObject Pages
对象页面
Object Pages are dedicated pages used to display and manage record-level data for a specific Salesforce entity/object. For example, an custom object "Car" should have "Car_Detail", "Car_List", and "Car_Related_list" views.
对象页面是用于显示和管理特定Salesforce实体/对象的记录级数据的专用页面。例如,自定义对象“Car”应包含“Car_Detail”、“Car_List”和“Car_Related_list”视图。
References
参考文档
Reference docs within the skill directory. Note that these are local and not MCP.
Before doing anything, you MUST ALWAYS load them first if they match user intent.
- bootstrap-template-byo-lwr.md - Site creation, template defaults
- configure-content-route.md - Route creation (custom/object pages)
- configure-content-view.md - View creation/editing (custom/object pages)
- configure-content-themeLayout.md - Theme layout creation + theme sync
- configure-content-brandingSet.md - Branding with color patterns/WCAG
- handle-component-and-region-ids.md - UUID generation (CRITICAL) for component and region ids used in views and themeLayout.
- handle-ui-components.md - Component discovery, schemas, insertion, configuration
- configure-guest-sharing-rules.md - Guest sharing rules () for public sites — use for any request involving "guest sharing rule", "Site Guest User", or sharing object records with unauthenticated visitors
sharingGuestRules - update-site-urls.md - Updating site URLs - URL architecture, workflow for updating in DigitalExperienceConfig, Network, and CustomSite
urlPathPrefix
技能目录中的参考文档。请注意这些是本地文档,而非MCP文档。
执行任何操作之前,如果文档与用户意图匹配,你必须始终先加载它们。
- bootstrap-template-byo-lwr.md - 站点创建、模板默认设置
- configure-content-route.md - 路由创建(自定义/对象页面)
- configure-content-view.md - 视图创建/编辑(自定义/对象页面)
- configure-content-themeLayout.md - 主题布局创建 + 主题同步
- configure-content-brandingSet.md - 品牌设置(颜色模式/WCAG合规)
- handle-component-and-region-ids.md - UUID生成(至关重要),用于视图和themeLayout中的组件和区域ID。
- handle-ui-components.md - 组件发现、架构、插入、配置
- configure-guest-sharing-rules.md - 访客共享规则(),适用于公开站点——用于任何涉及“访客共享规则”、“站点访客用户”或向未认证访客共享对象记录的请求
sharingGuestRules - update-site-urls.md - 更新站点URL - URL架构、更新DigitalExperienceConfig、Network和CustomSite中的工作流
urlPathPrefix
Common Workflows
常见工作流
- See References for detailed capabilities.
- Always follow the steps defined in the workflows sequentially whether the task is small, big, quick, or complex.
- 详细功能请查看参考文档。
- 始终按顺序遵循工作流中定义的步骤,无论任务大小或复杂程度如何。
Creating a New Site
创建新站点
Rules:
- NEVER generate the files manually.
Steps (Follow the steps sequentially. Do not skip any step before proceeding):
- ALWAYS read bootstrap-template-byo-lwr.md within the skill directory. Do not proceed to the next step without loading the file.
- Follow the bootstrap doc strictly on site creation
规则:
- 绝对不要手动生成文件。
步骤(按顺序执行,不要跳过任何步骤):
- 必须阅读技能目录中的bootstrap-template-byo-lwr.md。未加载该文件前,不要进行下一步。
- 严格按照启动文档中的说明创建站点
Creating and Editing Standard or Object Pages
创建和编辑标准或对象页面
Steps (Follow the steps sequentially. Do not skip any step before proceeding):
- MUST read configure-content-route.md
- MUST read configure-content-view.md
- MUST read handle-component-and-region-ids.md
步骤(按顺序执行,不要跳过任何步骤):
- 必须阅读configure-content-route.md
- 必须阅读configure-content-view.md
- 必须阅读handle-component-and-region-ids.md
Adding UI Components to Pages
向页面添加UI组件
Steps (Follow the steps sequentially. Do not skip any step before proceeding):
- MUST read handle-ui-components.md to add LWCs to LWR sites.
- MUST read handle-component-and-region-ids.md to handle id generation
- MUST read configure-content-themeLayout.md if a component has one of the following requirements:
- needs to be "sticky" and persistent across pages
- is used as a theme layout
步骤(按顺序执行,不要跳过任何步骤):
- 必须阅读handle-ui-components.md以在LWR站点中添加LWC组件。
- 必须阅读handle-component-and-region-ids.md以处理ID生成
- 如果组件有以下任一需求,必须阅读configure-content-themeLayout.md:
- 需要“固定”并跨页面持久化
- 用作主题布局
Creating Page Layouts / Container Components
创建页面布局/容器组件
Steps (Follow the steps sequentially. Do not skip any step before proceeding):
- MUST read handle-ui-components.md
步骤(按顺序执行,不要跳过任何步骤):
- 必须阅读handle-ui-components.md
Creating Theme Layouts
创建主题布局
Steps (Follow the steps sequentially. Do not skip any step before proceeding):
- CRITICAL:Before doing anything else, MUST Check with user whether this new theme layout reuses an existing theme layout Lightning web component or requires a new one. If it requires a new one, make sure to read handle-ui-components.md to create the new theme layout component before proceeding. DO NOT skip this step even if doing so would be faster or more efficient.
- MUST read configure-content-themeLayout.md.
- MUST read configure-content-view.md if need to apply theme layout to pages
步骤(按顺序执行,不要跳过任何步骤):
- 至关重要: 在执行任何操作之前,必须与用户确认这个新主题布局是重用现有的主题布局Lightning Web组件,还是需要创建新组件。如果需要创建新组件,请务必先阅读handle-ui-components.md创建新的主题布局组件,然后再继续。即使跳过此步骤会更快或更高效,也绝对不要跳过。
- 必须阅读configure-content-themeLayout.md。
- 如果需要将主题布局应用到页面,必须阅读configure-content-view.md
Applying/Setting Theme Layouts
应用/设置主题布局
Steps (Follow the steps sequentially. Do not skip any step before proceeding):
- MUST read configure-content-view.md
步骤(按顺序执行,不要跳过任何步骤):
- 必须阅读configure-content-view.md
Configuring Branding
配置品牌设置
Steps (Follow the steps sequentially. Do not skip any step before proceeding):
- MUST read configure-content-brandingSet.md to configure background colors, foreground colors, button colors, and other branding colors that affect all pages.
步骤(按顺序执行,不要跳过任何步骤):
- 必须阅读configure-content-brandingSet.md以配置背景色、前景色、按钮颜色以及其他影响所有页面的品牌颜色。
CUD Operations on DigitalExperience Contents
DigitalExperience内容的增删改操作
- Users can perform create, update, delete operations on DigitalExperience Contents.
Steps (Follow the steps sequentially. Do not skip any step before proceeding):
- Determine what content types the user wants to modify
- MUST read the reference doc related to the target content types if the doc exists. e.g., if modifying , load configure-content-route.md.
sfdc_cms__route - MUST read handle-component-and-region-ids.md if creating or modifying view or theme layout
- Always Call to get the schema and examples for that content type after loading the corresponding reference docs.
execute_metadata_action- Call once per content type per user request: If you're creating/modifying multiple items of the same content type (e.g., creating 3 routes), you only need to call ONCE for that content type. Reuse the schema and examples for all items of that type within the same user request.
execute_metadata_action - For each unique content type you need to work with, always call using the following:
execute_metadata_action
- Call once per content type per user request: If you're creating/modifying multiple items of the same content type (e.g., creating 3 routes), you only need to call
json
{
"metadataType": "ExperienceSiteLwr",
"actionName": "getSiteContentMetadata",
"parameters": {
"contentType": "<content type from table above>",
"shouldIncludeExamples": true
}
}- 用户可以对DigitalExperience内容执行创建、更新、删除操作。
步骤(按顺序执行,不要跳过任何步骤):
- 确定用户想要修改的内容类型
- 如果存在相关参考文档,必须阅读与目标内容类型对应的文档。例如,如果修改,请加载configure-content-route.md。
sfdc_cms__route - 如果创建或修改视图或主题布局,必须阅读handle-component-and-region-ids.md
- 始终调用以获取该内容类型的架构和示例,在加载相应参考文档之后。
execute_metadata_action- 每个用户请求中每种内容类型仅调用一次: 如果要创建/修改同一内容类型的多个项目(例如:创建3个路由),只需针对该内容类型调用一次。在同一用户请求中,对该类型的所有项目重用架构和示例。
execute_metadata_action - 对于需要处理的每种独特内容类型,始终使用以下方式调用:
execute_metadata_action
- 每个用户请求中每种内容类型仅调用一次: 如果要创建/修改同一内容类型的多个项目(例如:创建3个路由),只需针对该内容类型调用
json
{
"metadataType": "ExperienceSiteLwr",
"actionName": "getSiteContentMetadata",
"parameters": {
"contentType": "<content type from table above>",
"shouldIncludeExamples": true
}
}Configuring Guest User Sharing Rules
配置访客用户共享规则
- MUST read configure-guest-sharing-rules.md and follow all steps there.
- 必须阅读configure-guest-sharing-rules.md并遵循其中的所有步骤。
Retrieving Site Preview and Builder URLs After Deployment
部署后获取站点预览和构建器URL
Use when user requests to preview a site, access a builder site, or after successfully deploying a site.
Use the MCP tool to get the preview and builder URLs:
execute_metadata_actionjson
{
"metadataType": "ExperienceSiteLwr",
"actionName": "getSiteUrls",
"parameters": {
"siteDevName": "<site developer name>"
}
}The site developer name can be found in the CustomSite filename (e.g., → developer name is ).
sites/MySite.site-meta.xmlMySiteIf the site is not found, an error message will be returned indicating that the site may not be deployed. Ensure the site has been successfully deployed before calling this action.
使用场景:用户请求预览站点、访问构建器站点,或成功部署站点之后。
使用 MCP工具获取预览和构建器URL:
execute_metadata_actionjson
{
"metadataType": "ExperienceSiteLwr",
"actionName": "getSiteUrls",
"parameters": {
"siteDevName": "<site developer name>"
}
}站点开发名称可在CustomSite文件名中找到(例如: → 开发名称为)。
sites/MySite.site-meta.xmlMySite如果未找到站点,将返回错误消息,表明站点可能尚未部署。调用此操作前,请确保站点已成功部署。
Updating Experience Site URLs
更新Experience站点URL
Use when user wants to update or change site URLs (urlPathPrefix).
Steps (Follow the steps sequentially. Do not skip any step before proceeding):
- MUST read update-site-urls.md to understand the three-component architecture and URL update workflow
- Follow the step-by-step workflow in the doc to update URLs consistently across all three components (DigitalExperienceConfig, Network, CustomSite)
使用场景:用户想要更新或更改站点URL(urlPathPrefix)。
步骤(按顺序执行,不要跳过任何步骤):
- 必须阅读update-site-urls.md以了解三组件架构和URL更新工作流
- 按照文档中的分步工作流,在所有三个组件(DigitalExperienceConfig、Network、CustomSite)中一致地更新URL
Validation & Deployment
验证与部署
Use CLI to validate and deploy. Access help docs by attaching , e.g.:
sf--helpsf project deploy --helpsf project deploy validate --help
Note that metadata types are space-delimited. Never wrap them in quotes or use commas. For example, is incorrect — always use .
--metadata "DigitalExperienceBundle DigitalExperience"--metadata DigitalExperienceBundle DigitalExperienceValidate:
bash
sf project deploy validate --metadata DigitalExperienceBundle DigitalExperience DigitalExperienceConfig Network CustomSite --target-org ${usernameOrAlias}Deploy:
bash
sf project deploy start --metadata DigitalExperienceBundle DigitalExperience DigitalExperienceConfig Network CustomSite --target-org ${usernameOrAlias}使用 CLI进行验证和部署。添加查看帮助文档,例如:
sf--helpsf project deploy --helpsf project deploy validate --help
请注意,元数据类型使用空格分隔。绝对不要用引号包裹或使用逗号。例如,是错误的——请始终使用。
--metadata "DigitalExperienceBundle DigitalExperience"--metadata DigitalExperienceBundle DigitalExperience验证:
bash
sf project deploy validate --metadata DigitalExperienceBundle DigitalExperience DigitalExperienceConfig Network CustomSite --target-org ${usernameOrAlias}部署:
bash
sf project deploy start --metadata DigitalExperienceBundle DigitalExperience DigitalExperienceConfig Network CustomSite --target-org ${usernameOrAlias}