* feat: update theme layout creation instructions * fix: revert UI component section * feat: specify order of operations for theme layout creation --------- Co-authored-by: Hemant Singh Bisht <hsinghbisht@salesforce.com>
5.1 KiB
Content Type: sfdc_cms__themeLayout
Use when user explicitly requests creating a new layout.
Table of Contents
-
Directory Structure
-
Purpose A: Generate new theme layouts under the
sfdc_cms__themeLayoutdirectory.- _meta.json Structure
- content.json Structure
- Naming Conventions
- Theme Sync After Creation
- Generation Checklist
-
Purpose B: Editing existing theme layouts under the
sfdc_cms__themeLayoutdirectory.
Directory Structure
- Location:
digitalExperiences/site/[SITE_NAME]/sfdc_cms__themeLayout/[THEME_LAYOUT_NAME]/ - Required Files:
_meta.json- Metadata file defining the API name and typecontent.json- Content file defining the configuration and layout
Purpose A: Generate New Theme Layouts
IMPORTANT: These guidelines should ONLY be applied when the user explicitly requests creating a new layout for their site. Do not apply these guidelines automatically for other tasks or when editing existing layouts.
Order of operations
If the user decides to create a new LWC, create the LWC first THEN the theme layout metadata.
_meta.json Structure
The _meta.json file must contain:
{
"apiName": "[THEME_LAYOUT_NAME]",
"type": "sfdc_cms__themeLayout",
"path": "themeLayouts"
}
Rules:
apiName: Must match the themeLayout directory name exactlytype: Always"sfdc_cms__themeLayout"path: Always"themeLayouts"
content.json Structure
The content.json file must contain:
{
"type": "sfdc_cms__themeLayout",
"title": "[DISPLAY_TITLE]",
"contentBody": {
"component": {
"attributes": { },
"children": [ "[regions in the layout]" ],
"definition": "[FQN of root layout component]",
"id": "[root component id]",
"type": "component"
}
},
"urlName": "[url name]"
}
Field Definitions:
type: Always"sfdc_cms__themeLayout"title: Human-readable display title, words separated by spaces (e.g. "Scoped Header and Footer")contentBody: Include allrequiredproperties fromschemaDefinition. UseexamplesOfContentTypefor reference.- Do not add additional fields.
urlName: URL identifier (lowercase, words separated by dashes e.g., "scoped-header-and-footer")contentBody.compnent.definition: The actual theme layout component that displays/renders the layout and includes theme region components.
Rules:
- Before any actions, always call
execute_metadata_actionto get the full schema and examples per the skill document.
Naming Conventions
- Directory Name: Should be in camelCase
- apiName: Must exactly match the directory name
- title: Human-readable title with spaces (e.g., "Service Not Available Theme Layout")
- urlName: Lowercase with hyphens for URL-friendly format (e.g., "new-layout")
Theme Sync After Creation
After creating a new sfdc_cms__themeLayout, you MUST update:
digitalExperiences/site/[SITE_NAME]/sfdc_cms__theme/[THEME_API_NAME]/content.json
Lookup: To find the theme content.json for the current site:
- Navigate up from the current theme layout directory to the site directory.
- Look in sfdc_cms__theme/ (sibling directory to sfdc_cms__themeLayout/).
- Find the theme directory (typically one per site).
- Read the file: content.json.
Action (append-only):
- ALWAYS append a new entry to
contentBody.layouts. - Do NOT replace or remove existing
layoutsentries. layoutIdMUST exactly match the new theme layoutapiName.layoutTypeMUST be chosen based on intended view usage.- Default: Generate a random 30-character alphanumeric string (e.g.,
xEGgPxY5j5TForZe3J7SBguOfQicEy) for thelayoutType. Ensure this string is unique and does not match any existinglayoutTypein the list.
- Default: Generate a random 30-character alphanumeric string (e.g.,
Example:
{
"contentBody": {
"layouts": [
{ "layoutId": "existingLayoutA", "layoutType": "Inner" },
{ "layoutId": "existingLayoutB", "layoutType": "ServiceNotAvailable" },
{ "layoutId": "[NEW_THEME_LAYOUT_API_NAME]", "layoutType": "[30_CHAR_RANDOM_STRING]" }
]
}
}
Generation Checklist
When generating a new theme layout, ensure:
_meta.jsoncreated with correctapiName,type, andpathcontent.jsoncreated with all required fieldsurlNameuses lowercase with hyphenstitleis human-readablesfdc_cms__theme/[THEME_API_NAME]/content.jsonupdated by appending a newcontentBody.layoutsmapping- CRITICAL: Complete all the UUID generation steps. See handle-component-and-region-ids.md
Purpose B: Editing Existing Theme Layouts
Component Modifications
When adding, removing, or configuring components in existing theme layouts, always refer to handle-ui-components.md for placement hierarchy, component structure, column layout, and property configuration.
Note: Theme layouts often define the overall structure (header/footer) surrounding the main content region. Ensure components are added to the correct region (e.g., header, footer).