Newer Version Available
CustomSite
Declarative Metadata File Suffix and Directory Location
Lightning Platform CustomSite components are stored in the sites directory of the corresponding package directory. The file name matches the site name, and the extension is .site.
Version
Lightning Platform CustomSite components are available in API version 14.0 and later.
Fields
SiteIframeWhiteListUrl
| Field | Field Type | Description |
|---|---|---|
| url | string | Required. The trusted domain that you allow to frame your site or Experience Cloud site pages. Accepts these formats: example, example.com, *example.com, and http://example.com. |
SiteRedirectMapping
SiteRedirectMapping represents a URL redirect rule on your Salesforce site. For more information, see “Salesforce Sites URL Redirects” in Salesforce Help.
| Field | Field Type | Description |
|---|---|---|
| action | SiteRedirect (enumeration of type string) | Required. The type of the redirect. Available string values are:
|
| isActive | boolean | The status of the redirect: active or inactive. |
| source | string | Required. The URL that you want to redirect. It must be a relative URL, but can have any valid extension type, such as .html or .php. |
| target | string | Required. The new URL you want users to visit. It can be a relative URL or a fully-qualified URL with an http:// or https:// prefix. |
SiteWebAddress
Represents the web address of a Salesforce site.
| Field | Field Type | Description |
|---|---|---|
| certificate | string | Identifies the certificate associated with the custom domain. If the custom domain is set up for Salesforce to serve HTTPS, this field indicates which certificate to use. |
| domainName | string | Required. The domain of the website, in the form of www.acme.com. |
| primary | boolean | Required. Indicates whether this is the primary domain (true). If false, this is not the primary domain. |
Declarative Metadata Sample Definition
Here is a sample XML definition of a site.
1<?xml version="1.0" encoding="UTF-8"?>
2<CustomSite xmlns="http://soap.sforce.com/2006/04/metadata">
3 <active>true</active>
4 <allowHomePage>true</allowHomePage>
5 <allowStandardIdeasPages>true</allowStandardIdeasPages>
6 <allowStandardLookups>true</allowStandardLookups>
7 <allowStandardPortalPages>true</allowStandardPortalPages>
8 <allowStandardSearch>true</allowStandardSearch>
9 <authorizationRequiredPage>Unauthorized</authorizationRequiredPage>
10 <bandwidthExceededPage>BandwidthExceeded</bandwidthExceededPage>
11 <browserXssProtection>true</browserXssProtection>
12 <changePasswordPage>ChangePassword</changePasswordPage>
13 <chatterAnswersForgotPasswordConfirmPage>ChatterAnswersForgotPasswordConfirm</chatterAnswersForgotPasswordConfirmPage>
14 <chatterAnswersForgotPasswordPage>ChatterAnswersForgotPassword</chatterAnswersForgotPasswordPage>
15 <chatterAnswersHelpPage>ChatterAnswersHelp</chatterAnswersHelpPage>
16 <chatterAnswersLoginPage>ChatterAnswersLogin</chatterAnswersLoginPage>
17 <chatterAnswersRegistrationPage>ChatterAnswersRegistration</chatterAnswersRegistrationPage>
18 <clickjackProtectionLevel>SameOriginOnly</clickjackProtectionLevel>
19 <contentSniffingProtection>true</contentSniffingProtection>
20 <customWebAddresses>
21 <domainName>www.testing123.com</domainName>
22 <primary>true</primary>
23 </customWebAddresses>
24 <description>Partners portal for My Company</description>
25 <enableAuraRequests>true</enableAuraRequests>
26 <favoriteIcon>myFavIcon</favoriteIcon>
27 <fileNotFoundPage>FileNotFound</fileNotFoundPage>
28 <forgotPasswordPage>ForgotPassword</forgotPasswordPage>
29 <genericErrorPage>Exception</genericErrorPage>
30 <inMaintenancePage>InMaintenance</inMaintenancePage>
31 <inactiveIndexPage>Inactive</inactiveIndexPage>
32 <indexPage>UnderConstruction</indexPage>
33 <myProfilePage>UserProfile</myProfilePage>
34 <masterLabel>customSite</masterLabel>
35 <portal>Customer Portal</portal>
36 <requireInsecurePortalAccess>false</requireInsecurePortalAccess>
37 <referrerPolicyOriginWhenCrossOrigin>true</referrerPolicyOriginWhenCrossOrigin>
38 <robotsTxtPage>RobotsTxt</robotsTxtPage>
39 <selfRegPage>SelfReg</selfRegPage>
40 <serverIsDown>MyServerDownResource</serverIsDown>
41 <siteAdmin>admin@myco.org</siteAdmin>
42 <siteGuestRecordDefaultOwner>admin@myco.org</siteGuestRecordDefaultOwner>
43 <siteIframeWhiteListUrl>
44 <url>example.com</url>
45 </siteIframeWhiteListUrl>
46 <siteTemplate>SiteTemplate</siteTemplate>
47 <subdomain>myco</subdomain>
48 <urlPathPrefix>partners</urlPathPrefix>
49</CustomSite>Wildcard Support in the Manifest File
This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.