community Commands

Use the community commands to create and publish an Experience Cloud site, and view a list of available templates in you org.

force:community:create

Creates an Experience Cloud site using a template.

Help for force:community:create

See "Which Experience Cloud Template Should I Use?" in Salesforce Help for more information about the different template types available for Experience Cloud.

When creating a site with the Build Your Own (LWR) template, you must also specify the AuthenticationType value using the format templateParams.AuthenticationType=value, where value is AUTHENTICATED, UNAUTHENTICATED, or AUTHENTICATED_WITH_PUBLIC_ACCESS. Name and values are case-sensitive. See "ExperienceBundle" in the Metadata API Developer Guide for more information.

When you execute this command, it creates the site in preview status, which means that it isn’t yet live. After you finish building your site, you can make it live.

If you have an Experience Builder site, publish the site using the sfdx force:community:publish command to make it live.

If you have a Salesforce Tabs + Visualforce site, activate the site to make it live by updating the status field of the Network type in the Metadata API. Alternatively, in Experience Workspaces, go to Administration | Settings, and click Activate.

For Experience Builder sites, activating the site just sends out a welcome email to site members.

Examples:

1$ sfdx force:community:create --name "My Customer Site" --templatename "Customer Service" --urlpathprefix customers --description "My customer site"
1$ sfdx force:community:create -n partnercentral -t "Partner Central" -p partners
1$ sfdx force:community:create -n lwrsite -t "Build Your Own (LWR)" -p lwrsite templateParams.AuthenticatedType=UNAUTHENTICATED

Command Syntax

sfdx force:community:create
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-n NAME
-t TEMPLATENAME
-p URLPATHPREFIX
[-d DESCRIPTION]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-n | --name NAME
Required

The name of the site to create.

Type: string
-t | --templatename TEMPLATENAME
Required

The template to use to create the site, such as the Customer Service template. Run force:community:template:list to see which templates are available in your org.

Type: string
-p | --urlpathprefix URLPATHPREFIX
Required

The URL to append to the domain that you created when you enabled Digital Experiences for this org. For example, if your domain name is UniversalTelco.force.com and you’re creating a customer site, enter "customers" to create the unique URL

UniversalTelco.force.com/customers.

Type: string
-d | --description DESCRIPTION
Optional

The description of the site. The description displays in Digital Experiences - All Sites in Setup and helps with site identification.

Type: string

force:community:publish

Publishes your Experience Builder site to make it live. Each time you publish it, you update the live site with the most recent updates.

Help for force:community:publish

When you publish an Experience Builder site for the first time, you make the site’s URL live and enable login access for site members.

Additionally, to send a welcome email to all site members, you must activate the site. (Activation is also required to successfully set up SEO for Experience Builder sites.) To activate a site, update the status field of the Network type in the Metadata API. Alternatively, in Experience Workspaces, go to Administration | Settings, and click Activate.

Subsequently, each time you publish the site, you update the live site with all changes made to the site since it was last published.

An email notification informs you when your changes are live.

Example:

1$ sfdx force:community:publish --name "My Customer Site"

Command Syntax

sfdx force:community:publish
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-n NAME

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-n | --name NAME
Required

The name of the Experience Builder site that you want to publish.

Type: string

force:community:template:list

Retrieves the list of templates available in your org for creating an Experience Cloud site.

Help for force:community:template:list

See "Which Experience Cloud Template Should I Use?" in Salesforce Help for more information about the different template types available for Experience Cloud.

Example:

1$ sfdx force:community:template:list

Command Syntax

sfdx force:community:template:list
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string