How to bulk import CMP content items with multi-languages into Sitecore Content Hub

If you have bulk imported DAM assets into your Sitecore Content Hub using the Excel Import, then you are already familiar with the process. In fact, I recently blogged on how to bulk import video subtitles with multi-languages.

However, Sitecore Content Hub is a great platform with many hidden gems. In this blog post, I will be exploring the hidden gems on how the bulk import CMP content items. Hopefully save you valuable time of having to figure out on your own.

What is Sitecore Content Hub CMP?

CMP stands for Content Marketing Platform.

Below is an excerpt from the Sitecore official docs

A Content Marketing Platform allows the planning, authoring, collaboration, curation and distribution of the different content types that drive the execution of a content marketing strategy while allowing campaign management. CMP is a central hub providing an overall view of all content and how it is performing. It is an essential platform to help with planning and analyzing content marketing campaigns and individual pieces of content.

Sitecore official docs

I will highly recommend watching the Sitecore Content Hub Content Marketing Platform (CMP) Walkthrough video from Sitecordial

For my use case, I will be looking at Blogs, which is one of the out of the box content types in CMP.

Creating a Blog entity within Content Hub CMP

  1. To create a Blog entity, on the Content creation page, select Add Content 
  2. On the add Content dialog, enter the Name and Type, which are mandatory fields. For Type, select Blog from the list of available Content Types. You can also specify the Locale (although this will default to your current Locale). Click Save to save your entry.
  3. Now select your new Blog item to edit. You should see the edit screen shown below. Enter content for the blog title, quote and body, then click Save to commit your changes.

Adding translations for multi-languages for your Blog entity

  1. To add a new translation, select the Localize action item from the Action menu, available from the top right-hand side of the edit screen.
  2. This will prompt you to enter name and locale on a popup shown below.
  3. Click Save to create this variant for the selected language
  4. This will then open the edit screen for you to edit the translated content for the blog item.

Preparing your CMP content items for Bulk Import

Now that we have familiarized ourselves on how to add a single Blog item and a single translation using the portal, let us look at bulk import.

 As usual, we will leverage the Excel Import template for the bulk import. In my related blog post, I already explained the pre-requisites you need for Excel Imports.

Blog items are M.Content entities, therefore we need to ensure our import worksheet is named M.Content

I have prepared an Export profile for exporting Blogs for your reference. You can access the Export Profiles area using the steps below.

Manage -> Export Profiles -> Create new export profile

The screenshot below shows my BlogContent export profile.

Key highlights on the Content export profile

Pay attention to the Relations section, where we are enabling the export of the related entities for:

  • ContentToContentVariant
  • ContentLifeCycleToContent
  • ContentTypeToContent
  • LocalizationToContent

Also, ensure includeSystemProperties is enabled.  

This export profile will output worksheets for these Relations for your reference when generating the Excel Import template.

Export your CMP Blog entities into Excel

  1. Navigate to your Content search portal page.
  2. Search and locate your blog(s). You can use the Filters section to filter Content type of Blog.
  3. Select the blog(s) entities (by ticking the checkbox of your selection component)
  4. On the right-hand side, access the Actions dropdown menu, and click on “Export to Excel” as shown below.
  5. Your download should be ready and accessible from Profile -> Downloads link

A look at M.Content Excel Import template

Your M.Content import template will look similar to this one below.

You can now view or download the full Excel template file that I have used

Key highlights:

  • Row 1 – this is the default blog entity based on your default language, e.g., en-US
  • Row 2 through 4 – these are the variants of the blog entity for my localized languages. In your case, you many more or less, as per your localized languages you are supporting.
  • Pay special attention to the ContentToContentVariant:Parent which is how the variants are linked to the default blog entity using identifier  id123456789-blog-en-US in my example.
  • Pay special attention to the ContentToContentVariant:Child which is how the default blog entity is linked to all variants. This will have pipe delimited list of variant identifiers (e.g., id123456789-blog-ar-AE|id123456789-blog-zh-CN|id123456789-blog-da-DK)
  • Please note, you need to pre-generate unique values for the identifier column for your variant blog entities. This ensures you can script and control how to link them with parent blog as shown above. This will be key to successful bulk import of the blog entities with multi-language support.
  • Use M.Content.IsVariant to mark which blog entities are variants
  • Use the CmpContentToLinkedAsset column to link the blog entities to existing assets (images or videos) from your DAM if required.  You can link multiple assets by using a pipe delimited list of assets identifiers.
  • Use the CmpContentToMasterLinkedAsset column to assign a Cover Image to the blog entities
  • The LocalizationToContent has the M.Localization taxonomy values corresponding to each localized language
  • I have provided default values for the columns Content.ApprovedForCreation, Content.IsInIdeationState, ContentLifeCycleToContent as per my use case. In your case, provide appropriate values that meet your content strategy.

Finally, let us do bulk import of Blog entities into CMP

And finally, to bulk import, use the Content Creation page. Ensure the creation component on your page has Import Excel option enabled.

  1. On the Content creation page, select Import Excel
  2. Do one of the following:
    • Drag the Excel file you want to upload into the dialog box.
    • Click browse, then pick the Excel file you want to upload.
  3. Optionally, click Add more to add more files if needed.
  4. Click Upload files.

 Next steps

On this blog post, we have looked at how to bulk import Blogs to your Sitecore Content Hub CMP. I am keen to hear your feedback or comments. Please do use the comments section for that.

Stay tuned for future posts as well look and feel free to look around at my existing posts on Sitecore platform.

How to bulk import Video Subtitles into Sitecore Content Hub

I recently was working on a cool project that required migration of hundreds of videos from a legacy video platform to Sitecore Content Hub as part of a digital modernization strategy. These video assets happened to have subtitles for multiple languages, which presented a significant challenge in itself.

If you are familiar with Sitecore Content Hub DAM, we have a capability to do a bulk import of DAM assets using the Excel import feature. There is also a fair number of blogs with guidance on how to go about this process. However, if you are looking for a quick guide on performing bulk import of video subtitles, there seems to be lack of documentation or step by step guidance.

I thought I document this process to fill this gap and share my story of overcoming this challenge.

First things first – recap on importing video subtitles via Portal page

I am assuming you already have a video asset imported into your Sitecore CH instance.

After selecting your video asset, the asset details page will look like this one below.

Clicking Upload files button will prompt with a dialog box shown below:

  • Click My device, navigate to the location of the files, select them, and then click Open. Optionally, to add more files, click + Add more; otherwise click Upload files.
  • Click From link, paste links to the files you want to upload, and then click Import.

Please note as of this writing, Sitecore CH supports only SRT and SUB subtitle formats.

After successful upload of the subtitle files, your Video subtitles section will look like this below.

At this stage, we haven’t specified the localised language for the subtitle file. To do this, click the file name or click Edit language and, in the Edit language dialog box, select the language from the drop-down list and then click Save.

Congratulations! You can now have the closed caption option (CC) show in the media player, which lets you select the uploaded subtitles to play along with your video.

Where are my subtitle files stored?

As you may have guessed it right, the subtitle files uploaded are actually M.Asset entities which as stored within the M.Content.Repository.Subtitle Content repository. You can view these files using your All-assets portal page, and filter the Subtitle Content repository.

How are the subtitle files linked to the video asset?

To view the subtitle and video asset relationship, head on to the Schema section by navigating to Manage -> Schema -> M.Asset

On the M.Asset schema page, search for subtitle. This will filter the schema for subtitles as show below.

This means that:

  • the video asset is the Parent of the Subtitle asset (AssetToSubtitleAsset:Parent)
  • the subtitle asset is the Child of Video asset (AssetToSubtitleAsset:Child)
  • the subtitle language is an OptionList

So, how do I bulk import Video Subtitles?

Now that we know subtitle are M.Asset entities, we will leverage the Excel Import template to achieve the bulk import.

When importing an Excel file, ensure that the name of each worksheet matches the name of the corresponding definition. For example, to import assets, a worksheet must be called M.Asset

You can hand-craft the Excel file if you already know the fields needed for your import. This guidance here also has preparation steps that you can undertake.

A safer option is to Export the sample video asset plus the subtitles, so you can figure out how the template should look like.

This will require creating an Export profile with minimal number of fields required for the bulk import. If you follow the steps on how to create an M.Asset export profile, you should end up with one similar to one below.

Manage -> Export Profiles -> Create new export profile

{
  "properties": [
    "File",
    "Title",
    "FileName",
    "SubtitleLanguage"
  ],
  "relations": {
    "AssetToSubtitleAsset": {
      "exportRelatedEntities": true
    }
  },
  "includeSystemProperties": true,
  "publicLinks": {
    "asset": false,
    "masterfile": false
  },
  "version": "1.1"
}

Pay attention to the Relations section, where we are enabling the export of the AssetToSubtitleAsset related entities. Also, ensure includeSystemProperties is enabled.

Export your sample video asset into Excel

  • Navigate to your Assets portal page.
  • Search and locate your video asset.
  • Select the video asset (tick the checkbox of your selection component)
  • On the right-hand side, access the Actions dropdown menu, and click on “Export to Excel”
  • Your download should be ready and accessible from Profile -> Downloads link

M.Asset Video Subtitles Import template

Your M.Asset video subtitles import template will look similar to this one below.

You can view and download sample Excel file too.

As you can see:

  • Row 1 – this has the M.Asset entity properties in your Sitecore CH instance
  • Row 2 and 3 – these have the entries for the two subtitles that we configured.
  • Row 4 – this is the entry for the video asset.
  • Pay special attention to the AssetToSubtitleAsset:Parent which is how the subtitles are linked to the parent video asset using identifier  id123456789 in this example
  • Pay special attention to the AssetToSubtitleAsset:Child which is how the video asset is linked to all subtitles. This will have pipe delimited list of subtitles identifiers (e.g., id123456789-viralvideo-ar-AE|id123456789-viralvideo-fr-FR)
  • Please note, you need to pre-generate unique values for the identifier column for your subtitles, in order to be link them with parent video as shown above. This will be key to successful bulk import of the subtiltes.
  • Use the File column for the URL to the actual video asset and subtitle assets.  

And finally, the bulk import from Excel

To bulk import, use the Asset Creation page.

  1. On the menu bar, click Create.
  2. On the Create page, in the top-right corner, click Add and then select Import Excel.
  3. Do one of the following:
    • Drag the Excel file you want to upload into the dialog box.
    • Click browse, then pick the Excel file you want to upload.
  4. Optionally, click Add more to add more files if needed.
  5. Click Upload files.

Next steps

On this blog post, we have look at how to bulk import video subtitles to your Sitecore Content Hub instance. I am keen to hear your feedback or comments. Please do use the comments section for that.

I have also blogged on How to bulk import CMP content items with multiple languages. Please check it out too.

Stay tuned for future posts as well look and feel free to look around at my existing posts on Sitecore platform.