Content Hub DAM Connector in an Environment Deployed to XM Cloud

 

Enabling the Content Hub DAM Connector in Sitecore XM Cloud

Do you use Sitecore and Content Hub for your business? If so, you might be wondering how to make these two platforms work seamlessly together. The solution is the Sitecore DAM component of the Sitecore Connect for Content Hub connector (SCCH). This component allows you to browse, search, and insert digital assets from Sitecore DAM directly into the Content and Experience Editor.

This guide will walk you through enabling the DAM connector for environments deployed in XM Cloud.

Prerequisites

Access to the XM Cloud Deploy app.

A user account in Sitecore Content Hub with the necessary permissions.

An OAuth client created for the DAM connector.

Steps to Enable the DAM Connector

Configure and Enable the DAM Connector in XM Cloud

Log in to the XM Cloud Deploy app.

In the navigation menu, click Projects.

Select the project containing the environment where you want to enable the DAM connector.

Click on the environment you want to configure.

Go to Variables and click Create variable.

Create the required variables. For each variable, set the target to CM.

Sitecore DAM Configuration

Sitecore DAM Configuration Variables

Variable Value Description
Sitecore_ConnectionStrings_DAM_dot_ContentHub ClientId={client_id};ClientSecret={client_secret};UserName={username};Password={password};URI={uri}; The Client ID and Client Secret, which belong to the connector's OAuth client. These credentials are required to establish a connection between the connector and both Sitecore and Content Hub platforms. The username and password of the Content Hub user that you created. This allows you to authenticate the connection and access the Content Hub instance. The correct URI for your Content Hub instance.
Sitecore_ConnectionStrings_DAM_dot_SearchPage https://your-content-hub-url/en-us/sitecore-dam-connect/approved-assets Sitecore Content Hub search page URL. The correct URI for your Content Hub instance.
Sitecore_ConnectionStrings_DAM_dot_ExternalRedirectKey Sitecore The URL of the page that opens the DAM in an IFrame. This ensures that Browse Sitecore DAM opens the right page and displays assets from the SCCH component.
SITECORE_AppSettings_damEnabled__define yes By default, when you deploy an environment to XM Cloud, the DAM connector is disabled. To enable the connector, set this value to yes.
Sitecore Variables

Sitecore Variables

Name Value Secret Target
Sitecore_ConnectionStrings_DAM_dot_SearchPage https://.../en-us/sitecore-dam-connect/approved-assets No CM
Sitecore_ConnectionStrings_DAM_dot_ExternalRedirectKey Sitecore No CM
Sitecore_ConnectionStrings_DAM_dot_ContentHub ClientId=...;ClientSecret=...;UserName=...;Password=...;URI=https://... No CM
SITECORE_AppSettings_damEnabled__define yes No CM


Configure the DAM Connection

Clone the source control repository for your XM Cloud environment.

In the repository folder, create this subfolder structure:

        {Project Repo Name}/src/platform/App_Data/Xdts

In the Xdts folder, create a file named Web.config.xdt. Open it for editing and add the required XML configuration.

  <?xml version="1.0" encoding="utf-8"?>

  <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

  <location path="sitecore">

  <system.webServer>

  <httpProtocol>

  <customHeaders>

  <!--DO NOT USE THIS CONTENT SECURITY POLICY EXAMPLE IN YOUR SOLUTION-->

  <add name="Content-Security-Policy" value="default-src 'self' 'unsafe-inline' 'unsafe-eval' [https://apps.sitecore.net](https://apps.sitecore.net/); img-src 'self' data: https://your-content-hub-url.cloud/ [https://s.gravatar.com](https://s.gravatar.com/) https://*.wp.com/cdn.auth0.com/avatars; style-src 'self' 'unsafe-inline' [https://fonts.googleapis.com](https://fonts.googleapis.com/); font-src 'self' 'unsafe-inline' [https://fonts.gstatic.com](https://fonts.gstatic.com/); block-all-mixed-content; child-src 'self' https://your-content-hub-url.cloud/; connect-src 'self' https://your-content-hub-url.cloud/; media-src https://your-content-hub-url.cloud/" xdt:Transform="Replace" xdt:Locator="Match(name)"/>

 </customHeaders>

 </httpProtocol>

 </system.webServer>

 </location>

 </configuration>

Save the file and update the xmcloud.build.json file with the transforms section..

 "transforms": [

 {

 "xdtPath": "/app_data/xdts/web.config.xdt",

 "targetPath": "/web.config"

 }

 ]


Update the Platform.csproj file to include App_Data.

 <ItemGroup>

 <Content Include="App_Data\**" />

 </ItemGroup>

Commit and push the changes, then build and deploy to your environment.

Once these steps are done you would be able to see the DAM folder in System/Modules & Templates in the Content Tree.



Configuring CORS for DAM

In the Sitecore DAM main menu, click Manage and then Settings.



Navigate to PortalConfiguration > CORSConfiguration.



Add the following URLs:

- XM Cloud Pages URL: https://pages.sitecorecloud.io/
- Environment Host Name URL: Example: https://my-xmc-environment-host-name.cloud/

Final Outcome

Once the setup is complete, you can:

- Browse, search, and insert digital assets from Sitecore DAM into the Content and Experience Editor.

- Use DAM assets in Image and Link fields effortlessly.

This integration simplifies asset management and enhances the editor experience.

Thanks for reading! If you have questions or need help, feel free to reach out!

 

Comments

Popular posts from this blog

Content Hub Integration with XM Cloud from Sitecore DAM directly from Sitecore DAM

Mastering Sitecore Search API Crawlers: A Comprehensive Series (Part 1-3)

Removing Edge Content and Purging Edge Cache with Sitecore XM Cloud Admin API