Akshay Sura - Partner
6 Sep 2020
In this video, I am going to go through how we tried to solve the issue of migrating products from your existing content into Sitecore Content Hub Content Marketing Platform (CMP).
Note: The following is the transcription of the video produced by an automated transcription system.
Hey, guys, this is Akshay Sura today will be walking through migrating content to the content hub CMP content marketing platform. This could be content, which you have in blogs and articles, news pages, anything of that sort in your external systems as well as, you know, including your Sitecore XP. And one of the common questions people ask is, why am I going to push everything from XP, Sitecore CMS, into content hub CMP? A very valid question. The answer is that, you know, when you’re in the Sitecore world for this long used to having content inside of the CMS, you tend to forget that the only purpose it’s there is primarily serving the goal of displaying that piece of content on your frontend website. What you do have to think about is you need to move yourself out of that role and into the part where the content production, the ideation, the creation all happens in one single place, which is the content hub. And then once you produce it, it goes into different channels. So, one of the channels is your Sitecore CMS. The other channel could be social media integration. Another channel could be syndication to external systems.
So, again, valid question, but it’s better to start going towards the goal of producing your content in CMP. Again, we talked about this in one of my previous blog posts. So, we do have a one-way integration from ICMP coming into XP. So, items that are created on CMP can be synched to synched back to the XP pretty easily. There are no two ways sync at this moment relational sync is in there either. But they are upcoming like the other systems, CMP relies on M.Content. That’s the main entity here, and M.Content relies on content type. So the content type being, you know, a blog, the user group, an article, and news, it is what you define and the content hub has a, you know, interesting way of dealing with content types. And we’ll go over that shortly. Now, in terms of moving data again from your external system, this could be your XP as well as the content we are pushing into Azure Queue which interacts with the content hub and then creates these content types. If you do have this CMP connector enabled, then you know it’s going to at the moment the content gets created. If you put it in the right publication status and you define that according to how however you configured your CMP connector, it’ll get synced back into Sitecore for the purpose of this demo. We’re just looking at item one and item two, not really looking at the CMP connector because we took care of it in a previous video.
This is a content hub, for instance. So what I would like to go through is I’m going to go into schema to show you guys the entity, which is M.Content, again, has a ton of attributes, is used by a couple of different things. Each, you know, the attribute has a bunch of sort of each section has a bunch of fields associated with it. For instance, the blog details may have fields that are specific to blog details with user group details. But if we go back here and I’m going to actually get back all the way here and then go into content types. So, as you can see, we have pre-defined content types, advertisement block, email recipes, social media webinar, and the white paper user group is something that I added then. I just had three fields inside that there I could add to the user group details. So, when you add a new type inside of the content types, what happens is that it also creates. Let me go into a taxonomy. And it creates an entry in this taxonomy as well. So, if we notice the blood type has a name, not content at our blog, and all the predefined types have a pretty identifier, but the ones we automate once we create manually have a different type of identifier. And this is crucial because even though you’re creating an entity of content when you’re going to assign a type to that content, you do need to know the identifier for the type of content you’re dealing with. And that’s very important. So, our goal is to be able to add these items in here.
So, I have a few, you know, tests which I ran just to make sure it’s actually running. All of them looked the same because I kept the same data. But we will try to add a blog type and a custom type, which is the user group that we created, and then see how that goes. Here we have our trusty sample application, which I use for quite a few things, including pushing data in and out so quickly, put together a UI that will let us out, and add a blog and a user group. Again, very simple information. I plugged in some sample info. Don’t expect this to be a production level. I just threw something together. So, I’m going to go ahead and create a blog, give it a second or two, and then I will do the same for the user group. Once those are created, I’ll come back here with a refresh. And as you can see, we see two of them created, so let’s go into the user group, make sure things are looking the way we want to. So, we created a user group and in there, this is the presentation. That’s the date and time, which Weatherfield and then I’ll go back and then let’s check the blog post and then also take a look at this. So, we have, um. Some information, as you can see, it was able to add the content we needed it to add. Next, we’ll take a look at the code to see how exactly this was accomplished. So here I have a Queue based function for processing blog.
Nothing out of the ordinary. We’re trying to use our Web SDK connects to the content hub, we’re trying to impersonate a user just so that it gets created under the user’s context. We are creating with the definition of M.Content, putting in some values here. Essentially, we are trying to specify get the blog content type ID dynamically without any numbers and then assign the content relationship. Same thing here, trying to assign the in progress lifecycle to it as well as the, uh, active or approved for creation state to this particular blog item. Same thing with the user group as well. The only difference is we get different, you know, a content type based on the user group we need with the definition name tag it super simple code, not really complicated. And this basically gets the job done. Again, thank you for watching the video. I hope you find this useful. We produce quite a bit of content in terms of blogs and videos in the Sitecore space and in the Microsoft stack. So please go ahead and subscribe to our LinkedIn, Twitter, and YouTube channels. Reach out to us through public channels if you need any help or any guidance or anything, we can help you solve. Thanks again for watching this video. Have a wonderful day.
If you have any questions, please get in touch with me. @akshaysura13 on Twitter or on Slack.
Akshay is an eight-time Sitecore MVP who has spent more than a decade working exclusively on Sitecore projects.
In addition to his work as a solution architect, Akshay is also one of the founders of SUGCON North America 2015, SUGCON India 2018 & 2019, Unofficial Sitecore Training, and the Sitecore Slack.
Akshay founded and continues to run the Sitecore Hackathon. As one of the managing partners of Konabos Consulting, Akshay will continue to work with clients to lead projects and mentor their existing teams.