From 4ff2be05c5b5397eab7c4f2d06dc528adf1a0b25 Mon Sep 17 00:00:00 2001 From: Joseph Bota Date: Mon, 16 Mar 2026 12:11:17 -0700 Subject: [PATCH] refine the skill with latest knowledge --- .../salesforce-experience-react-site/SKILL.md | 245 +++++++++++------- 1 file changed, 145 insertions(+), 100 deletions(-) diff --git a/skills/salesforce-experience-react-site/SKILL.md b/skills/salesforce-experience-react-site/SKILL.md index f48b347..c5bb9c8 100644 --- a/skills/salesforce-experience-react-site/SKILL.md +++ b/skills/salesforce-experience-react-site/SKILL.md @@ -1,15 +1,17 @@ --- name: salesforce-experience-react-site -description: Use this skill when users need to create or configure a Salesforce Digital Experience Site that hosts a React web application. Trigger when users mention creating an Experience site for a React app, setting up a React site on Salesforce, configuring Network/CustomSite/DigitalExperience metadata for a web app, or when they need to deploy site infrastructure for a React application. Also trigger when users mention site URL path prefixes, app namespaces, guest access configuration, DigitalExperienceConfig, DigitalExperienceBundle, or sfdc_cms__site content types in the context of React apps. Always use this skill for any React web application site creation or site infrastructure configuration work, even if the user just says "create a site for my React app." +description: Use this skill when users need to create or configure a Salesforce Digital Experience Site specifically for hosting a React web application. Trigger when users mention creating an Experience site for a React app, setting up a React site on Salesforce, configuring Network/CustomSite/DigitalExperience metadata for a web app, or deploying site infrastructure for a React application. Also trigger when users mention site URL path prefixes, app namespaces, appDevName, guest access configuration, DigitalExperienceConfig, DigitalExperienceBundle, or sfdc_cms__site content types in the context of React apps. Always use this skill for any React web application site creation or site infrastructure configuration work, even if the user just says "create a site for my React app" or "set up the site for my web application." --- # Digital Experience Site for React Web Applications -Create and configure Digital Experience Sites that host React web applications on Salesforce. This skill generates the minimum necessary site infrastructure — Network, CustomSite, DigitalExperienceConfig, DigitalExperienceBundle, and the sfdc_cms__site content type — to stand up a working site. +Create and configure Digital Experience Sites that host React web applications on Salesforce. This skill generates the minimum necessary site infrastructure — Network, CustomSite, DigitalExperienceConfig, DigitalExperienceBundle, and the `sfdc_cms__site` content type — so a React app can be served from Salesforce. + +React sites differ from standard LWR sites: they don't need routes, views, theme layouts, or branding sets. The site acts as a thin container (`appContainer: true`) that delegates rendering to the React application referenced by `appSpace`. ## Required Properties -Resolve all five properties before generating any metadata. Each has a fallback resolution chain — work through each option in order until a value is found. +Resolve all five properties before generating any metadata. Each has a fallback chain — work through each option in order until a value is found. | Property | Format | How to Resolve | |----------|--------|----------------| @@ -19,11 +21,13 @@ Resolve all five properties before generating any metadata. Each has a fallback | **appDevName** | String | `webApplication` metadata in the project → `sf data query -q "SELECT DeveloperName FROM WebApplication" --target-org ${usernameOrAlias}` → default to siteName | | **enableGuestAccess** | Boolean | Ask user whether unauthenticated guest users can access site APIs → default `false` | +The `appNamespace` and `appDevName` properties connect the site to the correct React application. Getting these wrong means the site deploys but shows a blank page, so take care to resolve them from real project data. + ## Generation Workflow ### Step 1: Resolve All Required Properties -Determine values for all five properties before constructing anything. Use the resolution strategies above, falling through each option until a value is found. +Determine values for all five properties before constructing anything. Use the resolution strategies in the table above, falling through each option until a value is found. ### Step 2: Create the Project Structure @@ -39,117 +43,157 @@ Create any files and directories that don't already exist, using these paths: | DigitalExperienceBundle | `digitalExperiences/site/{siteName}1/{siteName}1.digitalExperience-meta.xml` | | DigitalExperience (sfdc_cms__site) | `digitalExperiences/site/{siteName}1/sfdc_cms__site/{siteName}1/*` | -The DigitalExperience directory needs both a `_meta.json` and a `content.json` file. The only required content type is `sfdc_cms__site`. +The DigitalExperience directory contains only `_meta.json` and `content.json`. Do not create any directories other than `sfdc_cms__site` inside the bundle. ### Step 3: Populate All Metadata Fields -Use the field configurations below. Values in `{braces}` are resolved property references. +Use the templates below. Values in `{braces}` are resolved property references — substitute them with the actual values from Step 1. #### Network -| Field | Value | -|-------|-------| -| allowInternalUserLogin | false | -| allowMembersToFlag | false | -| changePasswordTemplate | unfiled$public/CommunityChangePasswordEmailTemplate | -| disableReputationRecordConversations | true | -| emailSenderAddress | admin@company.com | -| emailSenderName | {siteName} | -| embeddedLoginEnabled | false | -| enableApexCDNCaching | true | -| enableCustomVFErrorPageOverrides | false | -| enableDirectMessages | true | -| enableExpFriendlyUrlsAsDefault | false | -| enableExperienceBundleBasedSnaOverrideEnabled | true | -| enableGuestChatter | {enableGuestAccess} | -| enableGuestFileAccess | false | -| enableGuestMemberVisibility | false | -| enableImageOptimizationCDN | true | -| enableInvitation | false | -| enableKnowledgeable | false | -| enableLWRExperienceConnectedApp | false | -| enableMemberVisibility | false | -| enableNicknameDisplay | true | -| enablePrivateMessages | false | -| enableReputation | false | -| enableShowAllNetworkSettings | false | -| enableSiteAsContainer | true | -| enableTalkingAboutStats | true | -| enableTopicAssignmentRules | true | -| enableTopicSuggestions | false | -| enableUpDownVote | false | -| forgotPasswordTemplate | unfiled$public/CommunityForgotPasswordEmailTemplate | -| gatherCustomerSentimentData | false | -| headlessForgotPasswordTemplate | unfiled$public/CommunityHeadlessForgotPasswordTemplate | -| headlessRegistrationTemplate | unfiled$public/CommunityHeadlessRegistrationTemplate | -| networkMemberGroups | profile: admin | -| networkPageOverrides | changePasswordPageOverrideSetting: Standard, forgotPasswordPageOverrideSetting: Designer, homePageOverrideSetting: Designer, loginPageOverrideSetting: Designer, selfRegProfilePageOverrideSetting: Designer | -| newSenderAddress | admin@company.com | -| picassoSite | {siteName}1 | -| selfRegistration | false | -| sendWelcomeEmail | true | -| site | {siteName} | -| siteArchiveStatus | NotArchived | -| status | Live | -| tabs | defaultTab: home, standardTab: Chatter | -| urlPathPrefix | {siteUrlPathPrefix}vforcesite | -| welcomeTemplate | unfiled$public/CommunityWelcomeEmailTemplate | +```xml + + + false + false + unfiled$public/CommunityChangePasswordEmailTemplate + true + admin@company.com + {siteName} + false + true + false + true + false + true + {enableGuestAccess} + false + false + true + false + false + false + false + true + false + false + false + true + true + true + false + false + unfiled$public/CommunityForgotPasswordEmailTemplate + false + unfiled$public/CommunityHeadlessForgotPasswordTemplate + unfiled$public/CommunityHeadlessRegistrationTemplate + + admin + + + Standard + Designer + Designer + Designer + Designer + + admin@company.com + {siteName}1 + false + true + {siteName} + NotArchived + Live + + home + Chatter + + {siteUrlPathPrefix}vforcesite + unfiled$public/CommunityWelcomeEmailTemplate + +``` #### CustomSite -| Field | Value | -|-------|-------| -| active | true | -| allowGuestPaymentsApi | false | -| allowHomePage | false | -| allowStandardAnswersPages | false | -| allowStandardIdeasPages | false | -| allowStandardLookups | false | -| allowStandardPortalPages | true | -| allowStandardSearch | false | -| authorizationRequiredPage | CommunitiesLogin | -| bandwidthExceededPage | BandwidthExceeded | -| browserXssProtection | true | -| cachePublicVisualforcePagesInProxyServers | true | -| clickjackProtectionLevel | SameOriginOnly | -| contentSniffingProtection | true | -| enableAuraRequests | true | -| fileNotFoundPage | FileNotFound | -| genericErrorPage | Exception | -| inMaintenancePage | InMaintenance | -| indexPage | CommunitiesLanding | -| masterLabel | {siteName} | -| redirectToCustomDomain | false | -| referrerPolicyOriginWhenCrossOrigin | true | -| selfRegPage | CommunitiesSelfReg | -| siteType | ChatterNetwork | -| urlPathPrefix | {siteUrlPathPrefix}vforcesite | +```xml + + + true + false + false + false + false + false + true + false + CommunitiesLogin + BandwidthExceeded + true + true + SameOriginOnly + true + true + FileNotFound + Exception + InMaintenance + CommunitiesLanding + {siteName} + false + true + CommunitiesSelfReg + ChatterNetwork + {siteUrlPathPrefix}vforcesite + +``` #### DigitalExperienceConfig -| Field | Value | -|-------|-------| -| label | {siteName} | -| site.urlPathPrefix | {siteUrlPathPrefix} | -| space | site/{siteName}1 | +```xml + + + + + {siteUrlPathPrefix} + + site/{siteName}1 + +``` #### DigitalExperienceBundle -| Field | Value | -|-------|-------| -| label | {siteName}1 | +```xml + + + + +``` -#### DigitalExperience (sfdc_cms__site) +#### DigitalExperience — `_meta.json` -| Field | Value | -|-------|-------| -| apiName | {siteName}1 | -| type | sfdc_cms__site | -| title | {siteName} | -| urlName | {siteUrlPathPrefix} | -| contentBody.authenticationType | AUTHENTICATED_WITH_PUBLIC_ACCESS_ENABLED | -| contentBody.appContainer | true | -| contentBody.appSpace | {appNamespace}__{appDevName} | +```json +{ + "apiName": "{siteName}1", + "path": "", + "type": "sfdc_cms__site" +} +``` + +#### DigitalExperience — `content.json` + +```json +{ + "type": "sfdc_cms__site", + "title": "{siteName}", + "urlName": "{siteUrlPathPrefix}", + "contentBody": { + "authenticationType": "AUTHENTICATED_WITH_PUBLIC_ACCESS_ENABLED", + "appContainer": true, + "appSpace": "{appNamespace}__{appDevName}" + } +} +``` + +The `appContainer: true` and `appSpace` fields are what make this a React site rather than a standard LWR site. The `appSpace` value follows the format `{namespace}__{developerName}` and must match a deployed `WebApplication` metadata record. ### Step 4: Resolve Additional Configurations @@ -161,9 +205,10 @@ Before deploying, confirm: - [ ] All five required properties are resolved - [ ] All metadata directories and files exist per the project structure -- [ ] All metadata fields are populated per the configurations and user requests +- [ ] All metadata fields are populated per the templates and user requests +- [ ] `appSpace` in `content.json` matches an existing `WebApplication` metadata record - [ ] Deployment validates successfully: ```bash sf project deploy validate --metadata Network CustomSite DigitalExperienceConfig DigitalExperienceBundle DigitalExperience --target-org ${usernameOrAlias} -``` \ No newline at end of file +```