Hey friends. We have several different block types with mostly the same properties. Many of these blocks have the same content in them but render differently. Our content team wants to consolidate these blocks into one single block, and we then use template descriptors to handle the different renderings.
There is a feature to convert pages, but this still doesn’t do blocks unfortunately. I know Gulla has made his own version/copy for blocks. But that package is for CMS 11. We could follow his example and copy the stored procedures and make them work for blocks. This looks to me as the most viable option what I’ve seen so far.
As for the duplicate content, what would be the best way to replace one block instance with another? The IContentRepository has the method GetReferencesToContent which seems like a good start, but I don’t see any save-equivalence of that method, so we need to loop though each property of each reference content and change the content links? I hope there is a simpler way of doing this that we missed.
Any suggestions would be very welcome!
Personally, until an admin tool to convert blocks is made by Optimizely, I would just write a scheduled job to do the conversion. No add-ons, plugins, or SQL scripts. Just use the various provided services to do what I need to do:
Tomas Gulla made a package to do just this, but it's only out for CMS 11, but I'm sure it could help with guidance.
Original Blog: https://blog.novacare.no/convert-episerver-blocks/