---
schema_version: "1"
id: db11c87458e0eddaf3a112d6e485b38be8efebcd98044b8a793fb65b4b56cb08
title: template generate digital-experience site (Developer Preview)
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/template/cli_reference_template_generate_digital-experience_site.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_template_generate_digital-experience_site.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: fc8938e0dcca82ece0c720d671d1148d65ca6c9cb0367e476aebac98f8e2ec26
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# template generate digital-experience site (Developer Preview)

Generate an Experience Cloud site.

**note:** 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.

## Description for template generate digital-experience site

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.

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;admin&#8209;email</code> | <code>&#8209;e</code> | **Type:** Value<br><br>Email address for the site administrator. Defaults to the username of the currently authenticated user. |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;name</code> | <code>&#8209;n</code> | **Type:** Value<br>**Required**<br><br>Name of the Experience Cloud site to generate. |
| <code>&#8209;&#8209;output&#8209;dir</code> | <code>&#8209;d</code> | **Type:** Value<br><br>Directory to generate the site files in.<br><br>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. |
| <code>&#8209;&#8209;target&#8209;org</code> | <code>&#8209;o</code> | **Type:** Value<br><br>Username or alias of the target org. |
| <code>&#8209;&#8209;template&#8209;name</code> | <code>&#8209;t</code> | **Type:** Value<br>**Required**<br>**Valid Values:** `Build Your Own (LWR)`<br><br>Template to use when generating the site. |
| <code>&#8209;&#8209;url&#8209;path&#8209;prefix</code> | <code>&#8209;p</code> | **Type:** Value<br><br>URL path prefix for the site; must contain only alphanumeric characters. |

## Examples for template generate digital-experience site

Generate an Experience Cloud site using the Build Your Own (LWR) template. The site is called "mysite" and has the URL path prefix "mysite":

```shell
sf template generate digital-experience site --template-name "Build Your Own (LWR)" --name mysite --url-path-prefix mysite
```

Generate an Experience Cloud site like the last example, but generate the files into the specified output directory:

```shell
sf template generate digital-experience site --template-name "Build Your Own (LWR)" --name mysite --url-path-prefix mysite --output-dir force-app/main/default
```
<!-- prettier-ignore-end -->
