Sunday, 19 June 2022

Migrate Sitecore media library items into Content Hub - Part 1

 Have you run into the case where you needed to migrate your Sitecore media library assets into Sitecore Content Hub Digital Asset Management (DAM)? yes, no, or not yet, you will get into this at some point as content hub become more popular and more customers are interested in the composable world where Content Hub takes a central part in it. In this blog posts series we will go through the process of migrating your media library items into CH and updating the references in your content items to point to Content Hub instead of your media items. 




In this first part we will talk about how you can migrate your media library assets into Content Hub, with the help of Sitecore PowerShell and the import using excel functionality the Content Hub offers out of the box, we will be able to migrate our media library items into Content Hub.


As you probably know that Sitecore Content Hub DAM offers an import through excel functionality, which allows you to import a group of assets at once, all what you need to do is to prepare an excel file with a sheet called [M.Asset] which has the right columns, like Url, Title, Description#en-US,...etc, then upload this document into Content Hub using the creation component, and then Sitecore Content Hub will take it from there, it will create a fetch and processing jobs needed to pull these in.

Another thing you would need to know that Sitecore Content Hub DAM provides a functionality to access these assets using public links, these public links are also entities in Content Hub, you can also create these using excel file upload/import, similar to what we do with Assets, this is very important in your migration trip, as we nee these migrated assets to be accessible through URL, all what we need to do here is to generate another excel sheet with a pre-defined identifier to be use as your known value for the generated public links, the excel file sheet name must be [M.PublicLink] this time. 

Following you can find a Sitecore PowerShell script that will take a root path, find all images under it, and add them into two excel sheets, one that will be used to import assets and the other will be used to generate the public links. 



You will notice that the script will also count for the alternative text in case you have a multilingual case, there is also a third file that will be used in the second post when we update the references to these media items into content hub public links. stay tuned for the next post! 

No comments:

Post a Comment