template generate digital-experience site (Developer Preview)

Generate an Experience Cloud site.

This command is available as a developer preview. The command isn’t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. All commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. Don’t implement functionality developed with these commands or tools.

Creates the metadata of an Experience Cloud site with the specified template, name, and URL path prefix. The output includes all the necessary metadata files, including DigitalExperienceConfig, DigitalExperienceBundle, Network, and CustomSite.

Unlike sf community create, which builds the site directly in the org, this command generates only the local metadata.

Flag Name (Long)Flag Name (Short)Description
‑‑admin‑email‑eType: Value

Email address for the site administrator. Defaults to the username of the currently authenticated user.
‑‑flags‑dirN/AType: Value

Import flag values from a directory.
‑‑jsonN/AType: Boolean

Format output as json.
‑‑name‑nType: Value
Required

Name of the Experience Cloud site to generate.
‑‑output‑dir‑dType: Value

Directory to generate the site files in.

The location can be an absolute path or relative to the current working directory. If not specified, the command reads your sfdx-project.json file and uses the default package directory. When running outside a Salesforce DX project, defaults to the current directory.
‑‑target‑org‑oType: Value

Username or alias of the target org.
‑‑template‑name‑tType: Value
Required
Valid Values: Build Your Own (LWR)

Template to use when generating the site.
‑‑url‑path‑prefix‑pType: Value

URL path prefix for the site; must contain only alphanumeric characters.

Generate an Experience Cloud site using the Build Your Own (LWR) template. The site is called “mysite” and has the URL path prefix “mysite”:

Generate an Experience Cloud site like the last example, but generate the files into the specified output directory: