Blogs Migration

mohsine tahri asked on July 8, 2015 18:56

Hi, Recently, we decided to migrate one of our website from K6 to K7, we have a lot of blogs in this website, but we successfuly migrated them, my issue is that before in k6, we had multiple blogs that contained blog month and then blog posts, we did so to categorise the blog posts, but in the new version we decided to use the tags, it works correctly, but the issue is when we migrate the blog month from the old site to the new one, we kinda get duplicate blog months with different content instead of merging the content.

What i mean is, for example, we had a blog month "2011-05", which contained some blogs, and we wanted to migrate another blog month "2011-05", we expected that both blog months will merge, which it didnt, we ended up with two blog months with the same name "2011-05", althought with different blog posts inside.

My question is, is there a settings or a way to migrate blog post, in a way that it will create blog months only when it doesnt exist, if it does, it will add the blog post the existing blog month.

Thank you.

Recent Answers


Roman Hutnyk answered on July 8, 2015 19:43

Not sure this will work, but anyway: have you tried to migrate blog posts only, without migrating blog months? - I assume system might put them in the correct location.

0 votesVote for this answer Mark as a Correct answer

mohsine tahri answered on July 8, 2015 19:46

Well the thing is we have 3000 blog posts in different blog months in different blogs, so i cant really go moving them one by one.

What we did is use the "List" feature to move all the blog month, thus blog post, in each blog, but doing it this was duplicate the blog month in the destination, which i want to avoid.

I tried to apply the "List" feature to select only blog post, but it didnt work.

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on July 8, 2015 19:49

It there a way to select all documents of BlogPost type?

0 votesVote for this answer Mark as a Correct answer

mohsine tahri answered on July 8, 2015 19:53

As far as i know, no.

It seems the "List" feature only display the documents that are a direct child of the current document, it doesnt consider nested documents.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on July 8, 2015 21:30

You can simply run a query directly against the database that will get this information and allow you to export the data into a CSV format and then use the Import Toolkit to import the data. You may have to do some cleanup on the data when you export it so it is only getting unique months and such but that can be done.

The view query you want to run will be

SELECT * FROM View_CONTENT_BlogPost_Joined

0 votesVote for this answer Mark as a Correct answer

mohsine tahri answered on July 9, 2015 17:07

Well, at this point, that is not an option, like i said before, we have 3000 blogs, and we are at the final step of the migration project, the only issue i have here is the duplicated blog month, i cant afford to change the way we export data at this point.

Isnt there any merge functionality, or maybe updating data in DB so that the duplicated blog month would be deleted, their content added to the other blog month.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on July 10, 2015 14:50

Why is it not an option? How hard is it to run some sql queries to determine duplicates and eliminate them? If you need an option, this one seems to be pretty easy in comparison. I've done this before with XML feeds of thousands of blog posts from other providers like WordPress and it works. The best part about this option is you're exporting from a Kentico instance so the necessary fields (node alias, node alias path, language, etc) are already going to be part of the dataset.

No there isn't a merge function within the import toolkit. Also, you need to implement your structure as it appears in your content tree. So if you have /blog/month/post that's how you need to import them; blog first (or manually create it), blog months second, then the actual blog posts. If you have /blogs/blog/month/post and you want to merge all the blogs into one, then you will have to do some data manipulation because the import toolkit doesn't allow you to do this.

If you've already exported and imported and they are wrong and there isn't an automated way to change it, you really can't afford to keep going down that road either. You know the old saying, "It's never too late to turn back." Running the query takes about 10 seconds. Exporting to Excel is another 10 seconds, reviewing the data and making changes, checking for duplicates, etc. may take an hour or two or half a day and the import process will take maybe 30-60 minutes. Seems pretty viable to me.

Good luck!

0 votesVote for this answer Mark as a Correct answer

mohsine tahri answered on July 10, 2015 17:39

Well, thank you for the suggestion.

The way i resolved it is by using the API, i used the code used to add a new blog post, and it worked perfectly.

Althought, i got a little issue with blog post who have 2 cultures, the thing is, it create me the blog month in one culture, but for the other its there but it ask me to create from the other culture, is there a way to check if a blog post has multiple culture, and if so create a blog month for each culture.

The function i used to resolve my problem is: EnsureBlogPostHierarchy.

I kinda used a cutom made one, cause we use different naming in the blog month, but it seems to me, that this function only create a blog month for the main culture, it doesnt create it for the other culture.

Is there a way to do it by code, thank you.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.